Exemple #1
0
/**
 * lookup the given string in the table.  Return a pointer
 * to the place it is, or the place where it should be.
 */
static int find_place(const char * str, String_set *ss)
{
	int h, s, i;
	h = hash_string(str, ss);
	s = stride_hash_string(str, ss);
	for (i=h; 1; i = (i + s)%(ss->size)) {
		if ((ss->table[i] == NULL) || (strcmp(ss->table[i], str) == 0)) return i;
	}
}
Exemple #2
0
int find_place(wchar_t * str, String_set *ss) {
    /* lookup the given string in the table.  Return a pointer
       to the place it is, or the place where it should be. */
    int h, s, i;
    h = hash_string(str, ss);
    s = stride_hash_string(str, ss);
    for (i=h; 1; i = (i + s)%(ss->size)) {
	if ((ss->table[i] == NULL) || (wcscmp(ss->table[i], str) == 0)) return i;
    }
}
Exemple #3
0
/**
 * lookup the given string in the table.  Return an index
 * to the place it is, or the place where it should be.
 */
static unsigned int find_place(const char * str, String_id *ss)
{
	unsigned int h, s;
	h = hash_string(str, ss);

	if ((ss->table[h].str == NULL) || (strcmp(ss->table[h].str, str) == 0)) return h;
	s = stride_hash_string(str, ss);
	while (true)
	{
		h = h + s;
		if (h >= ss->size) h %= ss->size;
		if ((ss->table[h].str == NULL) || (strcmp(ss->table[h].str, str) == 0)) return h;
	}
}