diff options
author | Stan Shebs <shebs@codesourcery.com> | 1993-08-09 23:49:18 +0000 |
---|---|---|
committer | Stan Shebs <shebs@codesourcery.com> | 1993-08-09 23:49:18 +0000 |
commit | 48f075eb2a8dc66ec671a1486073f8ba4d47f9ba (patch) | |
tree | aa9fe38d256e4da7e1f97fdc41b42445079c8408 /gdb | |
parent | 716f859496348d496e01271679f4e079dc8dac86 (diff) | |
download | gdb-48f075eb2a8dc66ec671a1486073f8ba4d47f9ba.zip gdb-48f075eb2a8dc66ec671a1486073f8ba4d47f9ba.tar.gz gdb-48f075eb2a8dc66ec671a1486073f8ba4d47f9ba.tar.bz2 |
Moved the function hashname from stabsread.c to buildsym.c, since
it's a general-purpose function.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/buildsym.c | 31 | ||||
-rw-r--r-- | gdb/stabsread.c | 32 |
3 files changed, 36 insertions, 32 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8d79c41..f90ed16 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +Mon Aug 9 16:45:00 1993 Stan Shebs (shebs@rtl.cygnus.com) + + * stabsread.c, buildsym.c (hashname): Moved function to + buildsym.c, as suggested in the sources. + Mon Aug 9 09:53:45 1993 Jim Kingdon (kingdon@lioth.cygnus.com) * remote-udi.c: Make udi_ops extern rather than trying forward diff --git a/gdb/buildsym.c b/gdb/buildsym.c index ba593ca..a36ef79 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -855,6 +855,37 @@ push_context (desc, valu) } +/* Compute a small integer hash code for the given name. */ + +int +hashname (name) + char *name; +{ + register char *p = name; + register int total = p[0]; + register int c; + + c = p[1]; + total += c << 2; + if (c) + { + c = p[2]; + total += c << 4; + if (c) + { + total += p[3] << 6; + } + } + + /* Ensure result is positive. */ + if (total < 0) + { + total += (1000 << 6); + } + return (total % HASHSIZE); +} + + /* Initialize anything that needs initializing when starting to read a fresh piece of a symbol file, e.g. reading in the stuff corresponding to a psymtab. */ diff --git a/gdb/stabsread.c b/gdb/stabsread.c index c6864cd..f57bf8f 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -217,38 +217,6 @@ static int undef_types_length; } while (0) -/* This is used by other symbol readers besides stabs, so for cleanliness - should probably be in buildsym.c. */ - -int -hashname (name) - char *name; -{ - register char *p = name; - register int total = p[0]; - register int c; - - c = p[1]; - total += c << 2; - if (c) - { - c = p[2]; - total += c << 4; - if (c) - { - total += p[3] << 6; - } - } - - /* Ensure result is positive. */ - if (total < 0) - { - total += (1000 << 6); - } - return (total % HASHSIZE); -} - - /* Look up a dbx type-number pair. Return the address of the slot where the type for that number-pair is stored. The number-pair is in TYPENUMS. |