Mission Base

Program Base Library Functions

int pblHtRemove

( pblHashTable_t* h, void* key,
  size_t keylen )

Remove an item from the hash table.

Documentation

Remove an item from the hash table.

Parameters key and keylen are optional, if they are not given the current record is deleted

If the current record is removed the pointer to the current record is moved to the next record.

   Example:

for( data = pblHtFirst( h ); data; data = pblHtRemove( h, 0, 0 )) { this loop removes all items from a hash table }

If the current record is moved by this function the next call to pblHtNext will return the data of the then current record. Therefore the following code does what is expected: It visits all items of the hash table and removes the expired ones.

   for( data = pblHtFirst( h ); data; data = pblHtNext( h ))
   {
       if( needs to be deleted( data ))
       {
           pblHtRemove( h, 0, 0 );
       }
   }
   

Parameters:
h - Hash table to remove from
key - OPT: Key to remove
keylen - OPT: Length of that key
Returns:
int ret == 0: OK.
int ret == -1: An error, see pbl_errno:
PBL_ERROR_NOT_FOUND - The current item is not positioned or there is no item with the given key.

Alphabetic index



This page was generated with the help of DOC++.