mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
Use size_t (not unsigned int) for hashes, since the gnulib hash module
now uses size_t.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
2004-05-06 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* src/muscle_tab.c (hash_muscle): Accept and return size_t, not
|
||||
unsigned int, for compatibility with latest gnulib hash module.
|
||||
* src/state.c (state_hash, state_hasher): Likewise.
|
||||
* src/symtab.c (hash_symbol, hash_symbol_hasher): Likewise.
|
||||
* src/uniqstr.c (hash_uniqstr): Likewise.
|
||||
|
||||
2004-05-03 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* NEWS: Unescaped newlines are no longer allowed in char & strings.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Muscle table manager for Bison.
|
||||
|
||||
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -50,8 +50,8 @@ hash_compare_muscles (void const *x, void const *y)
|
||||
return strcmp (m1->key, m2->key) == 0;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
hash_muscle (const void *x, unsigned int tablesize)
|
||||
static size_t
|
||||
hash_muscle (const void *x, size_t tablesize)
|
||||
{
|
||||
muscle_entry const *m = x;
|
||||
return hash_string (m->key, tablesize);
|
||||
|
||||
12
src/state.c
12
src/state.c
@@ -1,6 +1,6 @@
|
||||
/* Type definitions for nondeterministic finite state machine for Bison.
|
||||
|
||||
Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -279,19 +279,19 @@ state_comparator (void const *s1, void const *s2)
|
||||
return state_compare (s1, s2);
|
||||
}
|
||||
|
||||
static inline unsigned int
|
||||
state_hash (state const *s, unsigned int tablesize)
|
||||
static inline size_t
|
||||
state_hash (state const *s, size_t tablesize)
|
||||
{
|
||||
/* Add up the state's item numbers to get a hash key. */
|
||||
unsigned int key = 0;
|
||||
size_t key = 0;
|
||||
int i;
|
||||
for (i = 0; i < s->nitems; ++i)
|
||||
key += s->items[i];
|
||||
return key % tablesize;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
state_hasher (void const *s, unsigned int tablesize)
|
||||
static size_t
|
||||
state_hasher (void const *s, size_t tablesize)
|
||||
{
|
||||
return state_hash (s, tablesize);
|
||||
}
|
||||
|
||||
11
src/symtab.c
11
src/symtab.c
@@ -1,6 +1,7 @@
|
||||
/* Symbol table manager for Bison.
|
||||
|
||||
Copyright (C) 1984, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1989, 2000, 2001, 2002, 2004 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -403,15 +404,15 @@ hash_symbol_comparator (void const *m1, void const *m2)
|
||||
return hash_compare_symbol (m1, m2);
|
||||
}
|
||||
|
||||
static inline unsigned int
|
||||
hash_symbol (const symbol *m, unsigned int tablesize)
|
||||
static inline size_t
|
||||
hash_symbol (const symbol *m, size_t tablesize)
|
||||
{
|
||||
/* Since tags are unique, we can hash the pointer itself. */
|
||||
return ((uintptr_t) m->tag) % tablesize;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
hash_symbol_hasher (void const *m, unsigned int tablesize)
|
||||
static size_t
|
||||
hash_symbol_hasher (void const *m, size_t tablesize)
|
||||
{
|
||||
return hash_symbol (m, tablesize);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Keep a unique copy of strings.
|
||||
|
||||
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -97,8 +97,8 @@ hash_compare_uniqstr (void const *m1, void const *m2)
|
||||
return strcmp (m1, m2) == 0;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
hash_uniqstr (void const *m, unsigned int tablesize)
|
||||
static size_t
|
||||
hash_uniqstr (void const *m, size_t tablesize)
|
||||
{
|
||||
return hash_string (m, tablesize);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user