1 [patch] Code cleanup: New SYMBOL_HASH_NEXT
2 http://sourceware.org/ml/gdb-patches/2011-04/msg00022.html
3 http://sourceware.org/ml/gdb-cvs/2011-04/msg00043.html
5 ### src/gdb/ChangeLog 2011/04/06 03:24:22 1.12908
6 ### src/gdb/ChangeLog 2011/04/06 19:50:03 1.12909
8 +2011-04-06 Jan Kratochvil <jan.kratochvil@redhat.com>
11 + * dictionary.c (dict_hash): Use SYMBOL_HASH_NEXT.
12 + * dwarf2read.c (mapped_index_string_hash): Refer to SYMBOL_HASH_NEXT
13 + in the function comment, a new note on values compatibility.
14 + * minsyms.c (msymbol_hash_iw, msymbol_hash): Use SYMBOL_HASH_NEXT.
15 + * symtab.h (SYMBOL_HASH_NEXT): New.
17 2011-04-06 Thiago Jung Bauermann <bauerman@br.ibm.com>
19 * ppc-linux-nat.c (check_condition): Add len output parameter.
20 --- src/gdb/dictionary.c 2011/01/07 19:36:15 1.21
21 +++ src/gdb/dictionary.c 2011/04/06 19:50:04 1.22
26 - hash = hash * 67 + *string - 113;
27 + hash = SYMBOL_HASH_NEXT (hash, *string);
31 --- src/gdb/dwarf2read.c 2011/04/04 14:10:12 1.520
32 +++ src/gdb/dwarf2read.c 2011/04/06 19:50:04 1.521
33 @@ -1962,11 +1962,11 @@
34 do_cleanups (cleanup);
37 -/* The hash function for strings in the mapped index. This is the
38 - same as the hashtab.c hash function, but we keep a separate copy to
39 - maintain control over the implementation. This is necessary
40 - because the hash function is tied to the format of the mapped index
42 +/* The hash function for strings in the mapped index. This is the same as
43 + SYMBOL_HASH_NEXT, but we keep a separate copy to maintain control over the
44 + implementation. This is necessary because the hash function is tied to the
45 + format of the mapped index file. The hash values do not have to match with
46 + SYMBOL_HASH_NEXT. */
49 mapped_index_string_hash (const void *p)
50 --- src/gdb/minsyms.c 2011/03/28 20:29:51 1.81
51 +++ src/gdb/minsyms.c 2011/04/06 19:50:05 1.82
54 if (*string && *string != '(')
56 - hash = hash * 67 + *string - 113;
57 + hash = SYMBOL_HASH_NEXT (hash, *string);
62 unsigned int hash = 0;
64 for (; *string; ++string)
65 - hash = hash * 67 + *string - 113;
66 + hash = SYMBOL_HASH_NEXT (hash, *string);
70 --- src/gdb/symtab.h 2011/04/04 15:19:59 1.177
71 +++ src/gdb/symtab.h 2011/04/06 19:50:05 1.178
72 @@ -1004,6 +1004,12 @@
74 extern unsigned int msymbol_hash (const char *);
76 +/* Compute the next hash value from previous HASH and the character C. This
77 + is only a GDB in-memory computed value with no external files compatibility
80 +#define SYMBOL_HASH_NEXT(hash, c) ((hash) * 67 + (c) - 113)
82 extern struct objfile * msymbol_objfile (struct minimal_symbol *sym);