Configuration/add_to_keywords_hash_table [ Functions ]

FUNCTION

Add a keyword to the hash table

SYNOPSIS

void add_to_keywords_hash_table(
    char *keyword )

INPUTS

keyword -- The keyword string

SOURCE

{
    struct keywords_hash_s *tmp, **curr;
    unsigned long       hash;

    // Allocate space for new entry in hash table
    tmp = RB_malloc( sizeof( struct keywords_hash_s ) );
    // and initialise it
    tmp->keyword = keyword;
    tmp->next = NULL;

    // Calculate hash value
    hash = Hash_Keyword( keyword, strlen( keyword ) );

    // Seek to last element in hash table row
    for ( curr = &( keywords_hash[hash] ); *curr;
          curr = &( ( *curr )->next ) );

    // Insert entry into hash table
    *curr = tmp;
}