aboutsummaryrefslogtreecommitdiff
path: root/gdb/minsyms.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2001-10-12 19:07:07 +0000
committerDaniel Jacobowitz <drow@false.org>2001-10-12 19:07:07 +0000
commit375f3d864b1293ba56cd79980ac618e26c862246 (patch)
tree4c5c098dde8fac488379f0e516fe5072407a2fc3 /gdb/minsyms.c
parent6e9a3f4d034f998ffbf6128aae3a26d6745832a5 (diff)
downloadgdb-375f3d864b1293ba56cd79980ac618e26c862246.zip
gdb-375f3d864b1293ba56cd79980ac618e26c862246.tar.gz
gdb-375f3d864b1293ba56cd79980ac618e26c862246.tar.bz2
* minsyms.c (msymbol_hash): Use better hash function.
(msymbol_hash_iw): Likewise. Terminate loop at '(' properly. * objfiles.h: Increase MINIMAL_SYMBOL_HASH_SIZE to match modern binaries.
Diffstat (limited to 'gdb/minsyms.c')
-rw-r--r--gdb/minsyms.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 9481747..b20074b 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -96,8 +96,10 @@ msymbol_hash_iw (const char *string)
while (isspace (*string))
++string;
if (*string && *string != '(')
- hash = (31 * hash) + *string;
- ++string;
+ {
+ hash = hash * 67 + *string - 113;
+ ++string;
+ }
}
return hash % MINIMAL_SYMBOL_HASH_SIZE;
}
@@ -109,7 +111,7 @@ msymbol_hash (const char *string)
{
unsigned int hash = 0;
for (; *string; ++string)
- hash = (31 * hash) + *string;
+ hash = hash * 67 + *string - 113;
return hash % MINIMAL_SYMBOL_HASH_SIZE;
}