commit - 6cf0b638631b1dc09719d468e537fc3a98cac8c3
commit + ea5a61bfbe25779b1a51c76f6274262251c4da85
blob - 740aa382d9ba714b62d2116f82c3eab4a942e2a3
blob + e1ea88b55ce1bef309b407422cf1c2a90fe37b49
--- minip_m.h
+++ minip_m.h
}
#include <string.h> /* strcmp */
-#include <stdlib.h> /* realloc */
+#include <stdlib.h> /* calloc */
#include <limits.h> /* UINT_MAX */
#include <stdint.h> /* SIZE_MAX */
* two, we can run the intermediates modulo UINT_MAX+1.
*/
- /* hash (inp,sym) */
- for (i=0; i < sizeof inp; i++)
+ /* hash (pos,sym) */
+ for (i=0; i < sizeof inp.p; i++)
h0 = h0 * 33 + ((unsigned char *)&inp.p)[i];
for (i=0; sym[i] != '\0'; i++)
h0 = h0 * 33 + (unsigned char)sym[i];
- /* look up (inp,sym) in cache and return if found */
+ /* look up (pos,sym) in cache and return if found */
/* NB: count steps; the table could be filled with dummies */
for (i=0, h=h0, s=1; i < cache->capacity; i++, h+=s, s*=5) {
mem = cache->table + (h % cache->capacity);