]>
Commit | Line | Data |
---|---|---|
6ed6bacf AM |
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 | |
4 | ||
5 | ### src/gdb/ChangeLog 2011/04/06 03:24:22 1.12908 | |
6 | ### src/gdb/ChangeLog 2011/04/06 19:50:03 1.12909 | |
7 | ## -1,3 +1,12 @@ | |
8 | +2011-04-06 Jan Kratochvil <jan.kratochvil@redhat.com> | |
9 | + | |
10 | + Code cleanup. | |
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. | |
16 | + | |
17 | 2011-04-06 Thiago Jung Bauermann <bauerman@br.ibm.com> | |
18 | ||
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 | |
22 | @@ -826,7 +826,7 @@ | |
23 | } | |
24 | /* FALL THROUGH */ | |
25 | default: | |
26 | - hash = hash * 67 + *string - 113; | |
27 | + hash = SYMBOL_HASH_NEXT (hash, *string); | |
28 | string += 1; | |
29 | break; | |
30 | } | |
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); | |
35 | } | |
36 | ||
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 | |
41 | - file. */ | |
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. */ | |
47 | ||
48 | static hashval_t | |
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 | |
52 | @@ -91,7 +91,7 @@ | |
53 | ++string; | |
54 | if (*string && *string != '(') | |
55 | { | |
56 | - hash = hash * 67 + *string - 113; | |
57 | + hash = SYMBOL_HASH_NEXT (hash, *string); | |
58 | ++string; | |
59 | } | |
60 | } | |
61 | @@ -106,7 +106,7 @@ | |
62 | unsigned int hash = 0; | |
63 | ||
64 | for (; *string; ++string) | |
65 | - hash = hash * 67 + *string - 113; | |
66 | + hash = SYMBOL_HASH_NEXT (hash, *string); | |
67 | return hash; | |
68 | } | |
69 | ||
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 @@ | |
73 | ||
74 | extern unsigned int msymbol_hash (const char *); | |
75 | ||
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 | |
78 | + requirements. */ | |
79 | + | |
80 | +#define SYMBOL_HASH_NEXT(hash, c) ((hash) * 67 + (c) - 113) | |
81 | + | |
82 | extern struct objfile * msymbol_objfile (struct minimal_symbol *sym); | |
83 | ||
84 | extern void |