1 #ifndef MODINITTOOLS_LOGGING_H
2 #define MODINITTOOLS_LOGGING_H
4 /* Do we use syslog for messages or stderr? */
7 /* Do we want to silent drop all warnings? */
10 /* Number of times warn() has been called */
13 extern void fatal(const char *fmt
, ...);
14 extern void warn(const char *fmt
, ...);
16 #define NOFAIL(ptr) do_nofail((ptr), __FILE__, __LINE__, #ptr)
18 #define nofail_asprintf(ptr, ...) \
19 { if (asprintf((ptr), __VA_ARGS__) < 0) do_nofail(NULL, __FILE__, __LINE__, #ptr); }
21 static inline void *do_nofail(void *ptr
, const char *file
, int line
, const char *expr
)
24 fatal("Memory allocation failure %s line %d: %s.\n",
30 #endif /* MODINITTOOLS_LOGGING_H */