Home | History | Annotate | Download | only in src

Lines Matching refs:entry

164   PHashTableEntry *entry = table->entries[idx];
168 while (entry != NULL)
170 if (entry->key == NULL)
171 return entry;
173 entry = entry->next;
178 while (entry != NULL)
180 if (entry->hashCode == hashCode && table->args.compFunction(key, entry->key) == 0)
181 return entry;
183 entry = entry->next;
190 static void removeEntry(PHashTableEntry *entry)
192 if (entry->prev == NULL)
193 entry->table->entries[entry->idx] = entry->next;
195 entry->prev->next = entry->next;
197 if (entry->next != NULL)
198 entry->next->prev = entry->prev;
200 entry->table->size--;
202 entry->next = entry->table->freeList;
203 entry->table->freeList = entry;
204 /* clean up entry for re-use. */
205 entry->key = entry->value = NULL;
210 PHashTableEntry *entry;
219 if ((entry = getEntry(table, key, hashCode, idx)) != NULL)
221 *value = (void *) entry->value;
234 PHashTableEntry* entry;
242 rc = PHashTableGetEntry(table, key, &entry);
255 ESR_ReturnCode PHashTableGetEntry(PHashTable *table, const void *key, PHashTableEntry **entry)
261 if (table == NULL || entry == NULL)
270 *entry = result;
279 PHashTableEntry *entry, *tmp, *next;
300 for (entry = table->entries[i]; entry != NULL;)
302 idx = entry->hashCode % newCapacity;
306 entry->idx = idx;
308 next = entry->next;
310 if (entry->prev != NULL)
311 entry->prev->next = next;
316 next->prev = entry->prev;
319 entry->next = tmp;
320 entry->prev = NULL;
322 tmp->prev = entry;
323 table->entries[idx] = entry;
325 entry = next;
330 entry = entry->next;
345 PHashTableEntry *entry;
351 entry = getEntry(table, key, hashCode, idx);
352 if (entry != NULL)
354 if (oldValue != NULL) *oldValue = (void *) entry->value;
355 entry->value = value;
359 /* If we get here, we need to add a new entry. But first, verify if we need
390 for (i = 0, entry = block->entries; i < ALLOC_SIZE - 1; ++i, ++entry)
392 entry->next = entry+1;
394 entry->next = table->freeList;
400 /* Get an entry from the freeList. */
401 entry = table->freeList;
402 table->freeList = entry->next;
404 /* Initialize entry data structure. */
405 entry->table = table;
406 entry->idx = idx;
407 entry->key = key;
408 entry->value = value;
409 entry->hashCode = hashCode;
410 entry->next = table->entries[idx];
411 entry->prev = NULL;
412 if (entry->next != NULL)
413 entry->next->prev = entry;
414 table->entries[idx] = entry;
427 PHashTableEntry *entry;
440 entry = getEntry(table, key, hashCode, idx);
441 if (entry != NULL)
444 *oldValue = (void*) entry->value;
445 removeEntry(entry);
457 ESR_ReturnCode PHashTableEntryGetKeyValue(PHashTableEntry *entry,
461 if (entry == NULL) return ESR_INVALID_ARGUMENT;
463 if (key != NULL) *key = (void *) entry->key;
464 if (value != NULL) *value = (void *) entry->value;
470 * Sets the value associated with this entry.
471 * @param entry The hashtable entry.
472 * @param value The value to associate with the entry.
473 * @param oldvalue If this pointer is non-NULL, it will be set to the previous value associated with this entry.
475 ESR_ReturnCode PHashTableEntrySetValue(PHashTableEntry *entry,
479 if (entry == NULL) return ESR_INVALID_ARGUMENT;
481 if (oldValue != NULL) *oldValue = (void *) entry->value;
482 entry->value = value;
488 * Removes the entry from its hash table.
490 * @param entry The hashtable entry.
492 ESR_ReturnCode PHashTableEntryRemove(PHashTableEntry *entry)
494 if (entry == NULL)
497 removeEntry(entry);
502 static PHashTableEntry* iteratorAdvance(PHashTable *table, PHashTableEntry *entry)
506 if (entry != NULL)
508 idx = entry->idx;
509 entry = entry->next;
510 if (entry == NULL)
516 entry = table->entries[idx];
528 entry = table->entries[idx];
533 return entry;
537 ESR_ReturnCode PHashTableEntryGetFirst(PHashTable *table, PHashTableEntry **entry)
539 if (table == NULL || entry == NULL)
542 *entry = iteratorAdvance(table, NULL);
550 * @param key Returns the key associated with the entry, cannot be NULL.
551 * @param value If non-NULL, returns the value associated with the entry.
553 ESR_ReturnCode PHashTableEntryAdvance(PHashTableEntry **entry)
555 if (entry == NULL || *entry == NULL)
558 *entry = iteratorAdvance((*entry)->table, *entry);