IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 23, 2004, 5:31:22 PM (22 years ago)
Author:
evanalst
Message:

Function psHashRemove was changed to return boolean and removes the data
from the hash table.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sysUtils/psHash.c

    r1202 r1295  
    1010 *  @author George Gusciora, MHPCC
    1111 *   
    12  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-07-08 22:05:14 $
     12 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-07-24 03:31:06 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    357357    itemFree: a function pointer
    358358Return:
    359     NONE
     359    boolean value defining success or failure
    360360 *****************************************************************************/
    361361bool psHashAdd(psHash *table, const char *key, void *data)
     
    407407    itemFree: a function pointer
    408408Return:
    409     The data that was associated with that key.
    410  *****************************************************************************/
    411 void *psHashRemove(psHash *table, const char *key)
    412 {
     409    boolean value defining success or failure
     410 *****************************************************************************/
     411bool psHashRemove(psHash *table, const char *key)
     412{
     413    void *data = NULL;
     414    bool retVal = false;
     415
    413416    if (table == NULL) {
    414417        psAbort(__func__, "psHashRemove() called with NULL hash table.");
     
    418421    }
    419422
    420     return doHashWork(table, key, NULL, 1);
    421 }
     423    data = doHashWork(table, key, NULL, 1);
     424    if ( data != NULL) {
     425        psFree(data);
     426        retVal = true;
     427    } else {
     428        retVal = false;
     429    }
     430    return retVal;
     431}
Note: See TracChangeset for help on using the changeset viewer.