comparison libmlk-core/mlk/core/panic.c @ 475:1a1265445157

core: forgot panic_handler
author David Demelier <markand@malikania.fr>
date Mon, 27 Feb 2023 12:44:13 +0100
parents 01f5580e43d1
children d6757c30658e
comparison
equal deleted inserted replaced
474:ca30ff96bbe0 475:1a1265445157
29 fprintf(stderr, "abort: %s\n", error()); 29 fprintf(stderr, "abort: %s\n", error());
30 abort(); 30 abort();
31 exit(1); 31 exit(1);
32 } 32 }
33 33
34 void (*panic_handler)(void) = terminate; 34 void (*mlk_panic_handler)(void) = terminate;
35 35
36 void 36 void
37 mlk_panicf(const char *fmt, ...) 37 mlk_panicf(const char *fmt, ...)
38 { 38 {
39 assert(fmt); 39 assert(fmt);
53 53
54 void 54 void
55 mlk_panicva(const char *fmt, va_list ap) 55 mlk_panicva(const char *fmt, va_list ap)
56 { 56 {
57 assert(fmt); 57 assert(fmt);
58 assert(panic_handler); 58 assert(mlk_panic_handler);
59 59
60 errorva(fmt, ap); 60 errorva(fmt, ap);
61 mlk_panic(); 61 mlk_panic();
62 } 62 }
63 63
64 void 64 void
65 mlk_panic(void) 65 mlk_panic(void)
66 { 66 {
67 assert(panic_handler); 67 assert(mlk_panic_handler);
68 68
69 panic_handler(); 69 mlk_panic_handler();
70 70
71 /* 71 /*
72 * This should not happen, if it does it means the user did not fully 72 * This should not happen, if it does it means the user did not fully
73 * satisfied the constraint of panic_handler. 73 * satisfied the constraint of mlk_panic_handler.
74 */ 74 */
75 fprintf(stderr, "abort: panic handler returned\n"); 75 fprintf(stderr, "abort: panic handler returned\n");
76 exit(1); 76 exit(1);
77 } 77 }