Your patch is correct, the pointer cannot be const, as *prev and *base are modified, which are offsets of h->htable, which is 'const struct hash_entry *'.
arne
On Sat, 31 May 2014, Chris Angelico wrote:
On Sat, May 31, 2014 at 1:08 AM, Arne Goedeke el@laramies.com wrote:
I think the hash lookup should not modify the hash list. Its quite expensive to relink it on every lookup and definitely negates any intended speedup.
Interestingly, that code seems to go back all the way to the first pike commit from ulpc.
And before that, to the first import of ulpc - the only changes, as far as I can see, are the name lpc_string becoming pike_string, and then (very recently) the pointers got tagged const. Now THAT is stable code!
So the question is, what does a 'const struct hash_table *' imply? Is the entire table constant, or is it allowed to have mutable entries? And if the latter, at what point should the compiler be told that it's no longer const?
ChrisA