Back to index

tetex-bin  3.0
Functions
comp_hash.c File Reference
#include <curses.priv.h>
#include <tic.h>
#include <hashsize.h>

Go to the source code of this file.

Functions

static int hash_function (const char *)
 _nc_find_entry (const char *string, const struct name_table_entry *const *hash_table)
 _nc_find_type_entry (const char *string, int type, const struct name_table_entry *table)

Function Documentation

_nc_find_entry ( const char *  string,
const struct name_table_entry *const hash_table 
)

Definition at line 132 of file comp_hash.c.

{
    int hashvalue;
    struct name_table_entry const *ptr;

    hashvalue = hash_function(string);

    if ((ptr = hash_table[hashvalue]) != 0) {
       while (strcmp(ptr->nte_name, string) != 0) {
           if (ptr->nte_link < 0)
              return 0;
           ptr = ptr->nte_link + hash_table[HASHTABSIZE];
       }
    }

    return (ptr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

_nc_find_type_entry ( const char *  string,
int  type,
const struct name_table_entry table 
)

Definition at line 163 of file comp_hash.c.

{
    struct name_table_entry const *ptr;

    for (ptr = table; ptr < table + CAPTABSIZE; ptr++) {
       if (ptr->nte_type == type && strcmp(string, ptr->nte_name) == 0)
           return (ptr);
    }

    return ((struct name_table_entry *) NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int hash_function ( const char *  string) [static]

Definition at line 106 of file comp_hash.c.

{
    long sum = 0;

    DEBUG(9, ("hashing %s", string));
    while (*string) {
       sum += (long) (*string + (*(string + 1) << 8));
       string++;
    }

    DEBUG(9, ("sum is %ld", sum));
    return (int) (sum % HASHTABSIZE);
}

Here is the caller graph for this function: