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