[Patch] - remove duplicated hash function (beginner project)
Ian Lance Taylor
ian@airs.com
Sun Jan 29 06:54:00 GMT 2006
"Christophe Jaillet" <christophe.jaillet@wanadoo.fr> writes:
> 1) 'hashstr()' is only used in gen-protos.c and fix-header.c. In nearly
> all cases, then length passed to the function is the exact length of the
> string, so the whole string is hashed. The only execption is
> 'inrecognized_function()' where the length is given by the NODE_LEN macro
> but as far as I have investigated libcpp token, I think that it also retrun
> the length of the string.
NODE_LEN does return the length of the string, but libcpp does not
guarantee that the string will be null terminated. So unfortunately
you do need to pass down the length.
A different approach would be to use iterative_hash instead of
htab_hash_string.
Ian
More information about the Gcc-patches
mailing list