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 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.
}
/* FALL THROUGH */
default:
- hash = hash * 67 + *string - 113;
+ hash = SYMBOL_HASH_NEXT (hash, *string);
string += 1;
break;
}
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)
++string;
if (*string && *string != '(')
{
- hash = hash * 67 + *string - 113;
+ hash = SYMBOL_HASH_NEXT (hash, *string);
++string;
}
}
unsigned int hash = 0;
for (; *string; ++string)
- hash = hash * 67 + *string - 113;
+ hash = SYMBOL_HASH_NEXT (hash, *string);
return hash;
}
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