Lines Matching refs:idx
55 static int idx_grow(struct indexer *idx) in idx_grow() argument
60 if (idx->size >= IDX_ARRAY_SIZE) in idx_grow()
63 idx->array[idx->size] = calloc(IDX_ENTRY_SIZE, sizeof(union idx_entry)); in idx_grow()
64 if (!idx->array[idx->size]) in idx_grow()
67 entry = idx->array[idx->size]; in idx_grow()
68 start_index = idx->size << IDX_ENTRY_BITS; in idx_grow()
69 entry[IDX_ENTRY_SIZE - 1].next = idx->free_list; in idx_grow()
77 idx->free_list = start_index; in idx_grow()
78 idx->size++; in idx_grow()
86 int idx_insert(struct indexer *idx, void *item) in idx_insert() argument
91 if ((index = idx->free_list) == 0) { in idx_insert()
92 if ((index = idx_grow(idx)) <= 0) in idx_insert()
96 entry = idx->array[idx_array_index(index)]; in idx_insert()
97 idx->free_list = entry[idx_entry_index(index)].next; in idx_insert()
102 void *idx_remove(struct indexer *idx, int index) in idx_remove() argument
107 entry = idx->array[idx_array_index(index)]; in idx_remove()
109 entry[idx_entry_index(index)].next = idx->free_list; in idx_remove()
110 idx->free_list = index; in idx_remove()
114 void idx_replace(struct indexer *idx, int index, void *item) in idx_replace() argument
118 entry = idx->array[idx_array_index(index)]; in idx_replace()