From c0ad3c9aeb4b76da056b7338f90971a1ec3b40b6 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Thu, 14 Apr 2016 23:53:01 -0400 Subject: [PATCH] ex20 extra credit --- lcthw-remnants-2/Makefile | 2 +- lcthw-remnants-2/dbg.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lcthw-remnants-2/Makefile b/lcthw-remnants-2/Makefile index a082257..28ed832 100644 --- a/lcthw-remnants-2/Makefile +++ b/lcthw-remnants-2/Makefile @@ -1,5 +1,5 @@ SHELL=/bin/bash -CFLAGS=-Wall -g +CFLAGS=-Wall -g -DNDEBUG EXERCISES := $(shell ./list-exercises) diff --git a/lcthw-remnants-2/dbg.h b/lcthw-remnants-2/dbg.h index 21aacac..a7aaa6a 100644 --- a/lcthw-remnants-2/dbg.h +++ b/lcthw-remnants-2/dbg.h @@ -8,16 +8,16 @@ #ifdef NDEBUG #define debug(M, ...) #else -#define debug(M, ...) fprintf(stderr, "DEBUG %s:%d: " M "\n", __FILE__, __LINE__, ##__VA_ARGS__) +#define debug(M, ...) fprintf(stderr, "DEBUG %s:%d:%s: " M "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__) #endif #define clean_errno() (errno == 0 ? "None" : strerror(errno)) -#define log_err(M, ...) fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " M "\n", __FILE__, __LINE__, clean_errno(), ##__VA_ARGS__) +#define log_err(M, ...) fprintf(stderr, "[ERROR] (%s:%d:%s: errno: %s) " M "\n", __FILE__, __LINE__, __func__, clean_errno(), ##__VA_ARGS__) -#define log_warn(M, ...) fprintf(stderr, "[WARN] (%s:%d: errno: %s) " M "\n", __FILE__, __LINE__, clean_errno(), ##__VA_ARGS__) +#define log_warn(M, ...) fprintf(stderr, "[WARN] (%s:%d:%s: errno: %s) " M "\n", __FILE__, __LINE__, __func__, clean_errno(), ##__VA_ARGS__) -#define log_info(M, ...) fprintf(stderr, "[INFO] (%s:%d) " M "\n", __FILE__, __LINE__, ##__VA_ARGS__) +#define log_info(M, ...) fprintf(stderr, "[INFO] (%s:%d:%s) " M "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__) #define check(A, M, ...) if(!(A)) { log_err(M, ##__VA_ARGS__); errno=0; goto error; }