Lines Matching defs:probe

58 static int linear_probe_create(struct linear_probe *probe, uint32_t length)
60 probe->table = calloc(length, sizeof(*probe->table));
61 if (probe->table == NULL)
64 probe->ends = calloc(length, sizeof(*probe->ends));
65 if (probe->ends == NULL)
68 probe->length = length;
73 static void linear_probe_destroy(struct linear_probe *probe)
75 if (probe->length == 0)
78 free(probe->table);
79 free(probe->ends);
80 memset(probe, 0, sizeof(*probe));
83 static void linear_probe_insert(struct linear_probe *probe, uint32_t key,
86 assert(probe->length > key);
88 if (probe->table[key] != NULL) {
89 data->next = probe->table[key];
90 probe->table[key] = data;
92 probe->table[key] = probe->ends[key] = data;
96 static filename_trans_t *linear_probe_find(struct linear_probe *probe, uint32_t key)
98 assert(probe->length > key);
100 return probe->table[key];
103 /* Returns all chunks stored in the *probe as single-linked list */
104 static filename_trans_t *linear_probe_dump(struct linear_probe *probe,
111 for (i = 0; i < probe->length; i++) {
112 if (probe->table[i] != NULL) {
114 end = probe->ends[i];
115 probe->ends[i]->next = result;
116 result = probe->table[i];
117 probe->table[i] = probe->ends[i] = NULL;
1466 struct linear_probe probe;
1472 if (linear_probe_create(&probe, 4096)) { /* Assume 4096 is enough for most cases */
1498 if (ebitmap_length(&stypes) > probe.length) {
1499 linear_probe_destroy(&probe);
1500 if (linear_probe_create(&probe, ebitmap_length(&stypes))) {
1513 cur_trans = linear_probe_find(&probe, i);
1553 linear_probe_insert(&probe, i, new_trans);
1557 cur_trans = linear_probe_dump(&probe, &end);