ucif/antlr3/src/antlr3collections.c
static pANTLR3_HASH_ENTRY
antlr3HashRemove(pANTLR3_HASH_TABLE table, void * key)
{
    ANTLR3_UINT32           hash;
    pANTLR3_HASH_BUCKET     bucket;
    pANTLR3_HASH_ENTRY      entry;
    pANTLR3_HASH_ENTRY      * nextPointer;

    /* First we need to know the hash of the provided key
     */
    hash    = antlr3Hash(key, (ANTLR3_UINT32)strlen((const char *)key));

    /* Knowing the hash, we can find the bucket
     */
    bucket  = table->buckets + (hash % table->modulo);

    /* Now, we traverse the entries in the bucket until
     * we find the key or the end of the entires in the bucket.
     * We track the element prior to the one we are exmaining
     * as we need to set its next pointer to the next pointer
     * of the entry we are deleting (if we find it).
     */
    entry           =   bucket->entries;    /* Entry to examine                                     */
    nextPointer     = & bucket->entries;    /* Where to put the next pointer of the deleted entry   */

    while   (entry != NULL)
    {
        /* See if this is the entry we wish to delete
         */
        if  (strcmp((const char *)key, (const char *)entry->keybase.key.sKey) == 0)
        {
            /* It was the correct entry, so we set the next pointer
             * of the previous entry to the next pointer of this
             * located one, which takes it out of the chain.
             */
            (*nextPointer)              = entry->nextEntry;

            /* Release the key - if we allocated that
             */
        if (table->doStrdup == ANTLR3_TRUE)
        {
            ANTLR3_FREE(entry->keybase.key.sKey);
        }
            entry->keybase.key.sKey     = NULL;

            table->count--;

            return entry;
        }
        else
        {
            /* We found an entry but it wasn't the one that was wanted, so
             * move to the next one, if any.
             */
            nextPointer = & (entry->nextEntry);     /* Address of the next pointer in the current entry     */
            entry       = entry->nextEntry;         /* Address of the next element in the bucket (if any)   */
        }
    }

    return NULL;  /* Not found */
}
/** Remove the element in the hash table for a particular
 *  key value, if it exists - no error if it does not.
 */
Remove the element in the hash table for a particular
key value, if it exists - no error if it does not.
Remove the element in the hash table for a particular key value if it exists - no error if it does not .
static pANTLR3_HASH_ENTRY
antlr3HashRemove(pANTLR3_HASH_TABLE table, void * key)
{
    ANTLR3_UINT32           hash;
    pANTLR3_HASH_BUCKET     bucket;
    pANTLR3_HASH_ENTRY      entry;
    pANTLR3_HASH_ENTRY      * nextPointer;
    hash    = antlr3Hash(key, (ANTLR3_UINT32)strlen((const char *)key));
    bucket  = table->buckets + (hash % table->modulo);
    entry           =   bucket->entries;    
    nextPointer     = & bucket->entries;    
    while   (entry != NULL)
    {
        if  (strcmp((const char *)key, (const char *)entry->keybase.key.sKey) == 0)
        {
            (*nextPointer)              = entry->nextEntry;
        if (table->doStrdup == ANTLR3_TRUE)
        {
            ANTLR3_FREE(entry->keybase.key.sKey);
        }
            entry->keybase.key.sKey     = NULL;
            table->count--;
            return entry;
        }
        else
        {
            nextPointer = & (entry->nextEntry);     
            entry       = entry->nextEntry;         
        }
    }
    return NULL;  
}
static pANTLR3_HASH_ENTRY antlr3HashRemove ( pANTLR3_HASH_TABLE table , void * key ) { ANTLR3_UINT32 hash ; pANTLR3_HASH_BUCKET bucket ; pANTLR3_HASH_ENTRY entry ; pANTLR3_HASH_ENTRY * nextPointer ; hash = antlr3Hash ( key , ( ANTLR3_UINT32 ) strlen ( ( const char * ) key ) ) ; bucket = table -> buckets + ( hash % table -> modulo ) ; entry = bucket -> entries ; nextPointer = & bucket -> entries ; while ( entry != NULL ) { if ( strcmp ( ( const char * ) key , ( const char * ) entry -> keybase . key . sKey ) == 0 ) { ( * nextPointer ) = entry -> nextEntry ; if ( table -> doStrdup == ANTLR3_TRUE ) { ANTLR3_FREE ( entry -> keybase . key . sKey ) ; } entry -> keybase . key . sKey = NULL ; table -> count -- ; return entry ; } else { nextPointer = & ( entry -> nextEntry ) ; entry = entry -> nextEntry ; } } return NULL ; }
Remove the element in the hash table for a particular
  key value, if it exists - no error if it does not.
Remove the element in the hash table for a particular key value if it exists - no error if it does not .
/* First we need to know the hash of the provided key
     */ /* Knowing the hash, we can find the bucket
     */ /* Now, we traverse the entries in the bucket until
     * we find the key or the end of the entires in the bucket.
     * We track the element prior to the one we are exmaining
     * as we need to set its next pointer to the next pointer
     * of the entry we are deleting (if we find it).
     */ /* Entry to examine                                     */ /* Where to put the next pointer of the deleted entry   */ /* See if this is the entry we wish to delete
         */ /* It was the correct entry, so we set the next pointer
             * of the previous entry to the next pointer of this
             * located one, which takes it out of the chain.
             */ /* Release the key - if we allocated that
             */ /* We found an entry but it wasn't the one that was wanted, so
             * move to the next one, if any.
             */ /* Address of the next pointer in the current entry     */ /* Address of the next element in the bucket (if any)   */ /* Not found */