void grpc_timer_heap_remove(grpc_timer_heap *heap, grpc_timer *timer) { uint32_t i = timer->heap_index; if (i == heap->timer_count - 1) { heap->timer_count--; maybe_shrink(heap); return; } heap->timers[i] = heap->timers[heap->timer_count - 1]; heap->timers[i]->heap_index = i; heap->timer_count--; maybe_shrink(heap); note_changed_priority(heap, heap->timers[i]); }
/** * Insert an element into the hashset. If no element with key key exists yet, * then a new one is created and initialized with the InitData function. * Otherwise the exisiting element is returned (for hashs where key is equal to * value, nothing is returned.) * * @param self the hashset * @param key the key that identifies the data * @returns the existing or newly created data element (or nothing in case of hashs where keys are the while value) */ InsertReturnValue hashset_insert(HashSet *self, KeyType key) { #ifndef NDEBUG self->entries_version++; #endif maybe_shrink(self); maybe_grow(self); return insert_nogrow(self, key); }
void remove(SpecKeyT const& k) { T* idx = lookup(k); if(idx) { sassert(idx->is_filled()); idx->make_deleted(); sassert(!idx->is_filled()); --elems; ++deleted; maybe_shrink(); } }
void erase_if(Pred pred = Pred()) { for(std::size_t i = 0; i < t.size(); ++i) { if(t[i].is_filled() && pred(t[i].value())) { t[i].make_deleted(); --elems; ++deleted; } } maybe_shrink(); }
void small_hash__table__del( small_hash__table *table, small_hash__hash hash, small_hash__node *node) { /* Remove link from prev to us: */ if(node->prev) { node->prev->next = node->next; } else { /* anchor is prev */ small_hash__anchor *anchor = anchor_of_hash(table, hash); anchor->first = node->next; } /* Remove link from next to us: */ if(node->next) { node->next->prev = node->prev; } table->count--; maybe_shrink(table); }