* Stop all timers attached to this object. We can get away with this because * all object pointers are unique. */
| 2374 | * all object pointers are unique. |
| 2375 | */ |
| 2376 | void |
| 2377 | obj_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. |
no outgoing calls
no test coverage detected