build: Rename LD command variable to LDQ
[netsniff-ng.git] / die.c
blob4c0014d8cabe3bf63b57def548011f685740f71d
1 /*
2 * Subject to the GPL, version 2.
3 */
5 #include "xmalloc.h"
7 struct panic_func {
8 void *arg;
9 void (*on_panic)(void *arg);
10 struct panic_func *next;
13 static struct panic_func *panic_funcs;
15 void panic_func_add(void (*on_panic)(void *arg), void *arg)
17 struct panic_func *handler = xmallocz(sizeof(*handler));
19 handler->arg = arg;
20 handler->on_panic = on_panic;
21 handler->next = panic_funcs;
22 panic_funcs = handler;
25 void call_on_panic_funcs(void)
27 struct panic_func *it;
29 for (it = panic_funcs; it; it = it->next)
30 it->on_panic(it->arg);