MCPcopy Index your code
hub / github.com/NetHack/NetHack / obj_stop_timers

Function obj_stop_timers

src/timeout.c:2376–2398  ·  view source on GitHub ↗

* Stop all timers attached to this object. We can get away with this because * all object pointers are unique. */

Source from the content-addressed store, hash-verified

2374 * all object pointers are unique.
2375 */
2376void
2377obj_stop_timers(struct obj *obj)
2378{
2379 timeout_proc cleanup_func;
2380 timer_element *curr, *prev, *next_timer = 0;
2381
2382 for (prev = 0, curr = gt.timer_base; curr; curr = next_timer) {
2383 next_timer = curr->next;
2384 if (curr->kind == TIMER_OBJECT && curr->arg.a_obj == obj) {
2385 if (prev)
2386 prev->next = curr->next;
2387 else
2388 gt.timer_base = curr->next;
2389 if ((cleanup_func = timeout_funcs[curr->func_index].cleanup) != 0)
2390 (*cleanup_func)(&curr->arg, curr->timeout);
2391 (void) memset((genericptr_t) curr, 0, sizeof(timer_element));
2392 free((genericptr_t) curr);
2393 } else {
2394 prev = curr;
2395 }
2396 }
2397 obj->timed = 0;
2398}
2399
2400/*
2401 * Check whether object has a timer of type timer_type.

Callers 10

l_obj_timer_stopFunction · 0.85
hmon_hitmon_misc_objFunction · 0.85
mergedFunction · 0.85
food_disappearsFunction · 0.85
set_corpsenmFunction · 0.85
mkcorpstatFunction · 0.85
dealloc_objFunction · 0.85
stone_to_flesh_objFunction · 0.85
object_from_mapFunction · 0.85
add_to_billobjsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected