struct HashRec *h, *h0 = hash->rec;
int lga, cols, need = h0 ? h0->size - h0->dels : MIN_HASH_SIZE;
+ if(need < MIN_HASH_SIZE) need = MIN_HASH_SIZE;
for(lga=0; 1<<lga <= need; lga++);
cols = 1<<lga;
h = naAlloc(sizeof(struct HashRec) +
static void tmpStr(naRef* out, struct naStr* str, char* key)
{
str->len = 0;
- str->data = key;
+ str->data = (unsigned char*)key;
while(key[str->len]) str->len++;
*out = naNil();
out->ref.ptr.str = str;
{
int col;
struct HashRec* h = hash->rec;
- if(!h || h->size >= 1<<h->lgalloced)
+ while(!h || h->size >= 1<<h->lgalloced)
h = realloc(hash);
col = (HASH_MAGIC * sym->ref.ptr.str->hashcode) >> (32 - h->lgalloced);
INSERT(h, *sym, *val, col);