2016-08-22 22:53:26 +00:00
|
|
|
#ifndef __DEBUG_H
|
|
|
|
#define __DEBUG_H
|
|
|
|
|
2016-08-23 16:48:10 +00:00
|
|
|
#include <stdio.h>
|
2016-08-22 22:53:26 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2016-08-23 16:48:10 +00:00
|
|
|
|
2016-08-22 22:53:26 +00:00
|
|
|
static inline int dprint(const char *fmt, ...) {
|
|
|
|
va_list args;
|
|
|
|
va_start (args, fmt);
|
|
|
|
int n = vfprintf(stderr, fmt, args);
|
|
|
|
va_end (args);
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
2016-08-23 16:48:10 +00:00
|
|
|
static inline int dfprint(FILE *stream, const char *fmt, ...) {
|
|
|
|
va_list args;
|
|
|
|
va_start (args, fmt);
|
|
|
|
int n = vfprintf(stream, fmt, args);
|
|
|
|
va_end (args);
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
2016-08-22 22:53:26 +00:00
|
|
|
#else
|
2016-08-23 16:48:10 +00:00
|
|
|
|
|
|
|
#define dprint(...) do {} while (0)
|
|
|
|
#define dfprint(...) do {} while (0)
|
|
|
|
|
2016-08-22 22:53:26 +00:00
|
|
|
#endif
|
|
|
|
|
2016-08-23 16:48:10 +00:00
|
|
|
static inline
|
|
|
|
void dexit(int status) {}
|
|
|
|
|
2016-08-22 22:53:26 +00:00
|
|
|
#endif /* __DEBUG_H */
|