gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Wed, 6 Apr 2011 19:50:05 +0000 (19:50 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Wed, 6 Apr 2011 19:50:05 +0000 (19:50 +0000)
Code cleanup.
* dictionary.c (dict_hash): Use SYMBOL_HASH_NEXT.
* dwarf2read.c (mapped_index_string_hash): Refer to SYMBOL_HASH_NEXT
in the function comment, a new note on values compatibility.
* minsyms.c (msymbol_hash_iw, msymbol_hash): Use SYMBOL_HASH_NEXT.
* symtab.h (SYMBOL_HASH_NEXT): New.

gdb/ChangeLog
gdb/dictionary.c
gdb/dwarf2read.c
gdb/minsyms.c
gdb/symtab.h

index 031e53a505388d4e345a4edfa29a17a25e1e702c..349e47e155dac551d1d6d0a147dfd03ccf480165 100644 (file)
@@ -1,3 +1,12 @@
+2011-04-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       Code cleanup.
+       * dictionary.c (dict_hash): Use SYMBOL_HASH_NEXT.
+       * dwarf2read.c (mapped_index_string_hash): Refer to SYMBOL_HASH_NEXT
+       in the function comment, a new note on values compatibility.
+       * minsyms.c (msymbol_hash_iw, msymbol_hash): Use SYMBOL_HASH_NEXT.
+       * symtab.h (SYMBOL_HASH_NEXT): New.
+
 2011-04-06  Thiago Jung Bauermann  <bauerman@br.ibm.com>
 
        * ppc-linux-nat.c (check_condition): Add len output parameter.
index 29816921d91fb6cc96ccfd8bf022696dc0ed29c7..8142d291bea1a3156a4aee1a15f3fa4eca421433 100644 (file)
@@ -826,7 +826,7 @@ dict_hash (const char *string0)
            }
          /* FALL THROUGH */
        default:
-         hash = hash * 67 + *string - 113;
+         hash = SYMBOL_HASH_NEXT (hash, *string);
          string += 1;
          break;
        }
index 591e4740af9cb67fd2f597ed401cf75166a22b10..5086733e7cc380690421b724fe7f9a0efa94f46f 100644 (file)
@@ -1962,11 +1962,11 @@ create_addrmap_from_index (struct objfile *objfile, struct mapped_index *index)
   do_cleanups (cleanup);
 }
 
-/* The hash function for strings in the mapped index.  This is the
-   same as the hashtab.c hash function, but we keep a separate copy to
-   maintain control over the implementation.  This is necessary
-   because the hash function is tied to the format of the mapped index
-   file.  */
+/* The hash function for strings in the mapped index.  This is the same as
+   SYMBOL_HASH_NEXT, but we keep a separate copy to maintain control over the
+   implementation.  This is necessary because the hash function is tied to the
+   format of the mapped index file.  The hash values do not have to match with
+   SYMBOL_HASH_NEXT.  */
 
 static hashval_t
 mapped_index_string_hash (const void *p)
index b054e3ff9874ee7a6b9dda953b4cfd815b7bbe06..a2c5ebc0b1ded70d262d78fc27e41fe7fb55fe9f 100644 (file)
@@ -91,7 +91,7 @@ msymbol_hash_iw (const char *string)
        ++string;
       if (*string && *string != '(')
        {
-         hash = hash * 67 + *string - 113;
+         hash = SYMBOL_HASH_NEXT (hash, *string);
          ++string;
        }
     }
@@ -106,7 +106,7 @@ msymbol_hash (const char *string)
   unsigned int hash = 0;
 
   for (; *string; ++string)
-    hash = hash * 67 + *string - 113;
+    hash = SYMBOL_HASH_NEXT (hash, *string);
   return hash;
 }
 
index 59bbe2450f380ba25260454047b79921d4e16184..4913e6c0d80bccd6c3fd15533e743f32bf98cbb4 100644 (file)
@@ -1004,6 +1004,12 @@ extern unsigned int msymbol_hash_iw (const char *);
 
 extern unsigned int msymbol_hash (const char *);
 
+/* Compute the next hash value from previous HASH and the character C.  This
+   is only a GDB in-memory computed value with no external files compatibility
+   requirements.  */
+
+#define SYMBOL_HASH_NEXT(hash, c) ((hash) * 67 + (c) - 113)
+
 extern struct objfile * msymbol_objfile (struct minimal_symbol *sym);
 
 extern void
This page took 0.039762 seconds and 4 git commands to generate.