Lines Matching refs:table
439 t->table = (struct lh_entry*)calloc(size, sizeof(struct lh_entry)); in lh_table_new()
440 if(!t->table) lh_abort("lh_table_new: calloc failed\n"); in lh_table_new()
444 for(i = 0; i < size; i++) t->table[i].k = LH_EMPTY; in lh_table_new()
471 free(t->table); in lh_table_resize()
472 t->table = new_t->table; in lh_table_resize()
488 free(t->table); in lh_table_free()
504 if(t->table[n].k == LH_EMPTY || t->table[n].k == LH_FREED) break; in lh_table_insert()
509 t->table[n].k = k; in lh_table_insert()
510 t->table[n].v = v; in lh_table_insert()
514 t->head = t->tail = &t->table[n]; in lh_table_insert()
515 t->table[n].next = t->table[n].prev = NULL; in lh_table_insert()
517 t->tail->next = &t->table[n]; in lh_table_insert()
518 t->table[n].prev = t->tail; in lh_table_insert()
519 t->table[n].next = NULL; in lh_table_insert()
520 t->tail = &t->table[n]; in lh_table_insert()
535 if(t->table[n].k == LH_EMPTY) return NULL; in lh_table_lookup_entry()
536 if(t->table[n].k != LH_FREED && in lh_table_lookup_entry()
537 t->equal_fn(t->table[n].k, k)) return &t->table[n]; in lh_table_lookup_entry()
565 …ptrdiff_t n = (ptrdiff_t)(e - t->table); /* CAW: fixed to be 64bit nice, still need the crazy nega… in lh_table_delete_entry()
570 if(t->table[n].k == LH_EMPTY || t->table[n].k == LH_FREED) return -1; in lh_table_delete_entry()
573 t->table[n].v = NULL; in lh_table_delete_entry()
574 t->table[n].k = LH_FREED; in lh_table_delete_entry()
575 if(t->tail == &t->table[n] && t->head == &t->table[n]) { in lh_table_delete_entry()
577 } else if (t->head == &t->table[n]) { in lh_table_delete_entry()
580 } else if (t->tail == &t->table[n]) { in lh_table_delete_entry()
584 t->table[n].prev->next = t->table[n].next; in lh_table_delete_entry()
585 t->table[n].next->prev = t->table[n].prev; in lh_table_delete_entry()
587 t->table[n].next = t->table[n].prev = NULL; in lh_table_delete_entry()