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