Fixed style in several macros.

This commit is contained in:
Anony Moose 2013-08-24 20:52:20 +00:00
parent 4326c4c8b5
commit 39101b00a2
No known key found for this signature in database
GPG Key ID: A567AC285089C602

View File

@ -39,26 +39,26 @@ unsigned char *hex_string_to_bin(char hex_string[]);
#include <string.h>
#define DEBUG_PRINT(str, ...) do { \
char msg[1000]; \
sprintf(msg, "%s(): line %d (file %s): %s%%c\n", __FUNCTION__, __LINE__, __FILE__, str); \
fprintf(stderr, msg, __VA_ARGS__); \
} while (0)
char msg[1000]; \
sprintf(msg, "%s(): line %d (file %s): %s%%c\n", __FUNCTION__, __LINE__, __FILE__, str); \
fprintf(stderr, msg, __VA_ARGS__); \
} while (0)
#define WARNING(...) do { \
fprintf(stderr, "warning in "); \
DEBUG_PRINT(__VA_ARGS__, ' '); \
} while (0)
fprintf(stderr, "warning in "); \
DEBUG_PRINT(__VA_ARGS__, ' '); \
} while (0)
#define INFO(...) do { \
DEBUG_PRINT(__VA_ARGS__, ' '); \
} while (0)
DEBUG_PRINT(__VA_ARGS__, ' '); \
} while (0)
#undef ERROR
#define ERROR(exit_status, ...) do { \
fprintf(stderr, "error in "); \
DEBUG_PRINT(__VA_ARGS__, ' '); \
exit(exit_status); \
} while (0)
fprintf(stderr, "error in "); \
DEBUG_PRINT(__VA_ARGS__, ' '); \
exit(exit_status); \
} while (0)
#else
#define WARNING(...)
#define INFO(...)