diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2025-02-12 16:36:17 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2025-02-12 16:36:17 -0500 |
commit | 256c1869b0e9815cbd095e81ea97e92fc0fb61c0 (patch) | |
tree | 7d7b9c86855755575fec705c0ff00556db98cb3f /src | |
parent | 4e8732a2ad94982dcde175a6518da33021d2b6e8 (diff) | |
download | stasis-256c1869b0e9815cbd095e81ea97e92fc0fb61c0.tar.gz |
Move messaging macros into core_message.h
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/core/download.c | 1 | ||||
-rw-r--r-- | src/lib/core/include/core.h | 5 | ||||
-rw-r--r-- | src/lib/core/include/core_message.h | 19 |
3 files changed, 21 insertions, 4 deletions
diff --git a/src/lib/core/download.c b/src/lib/core/download.c index f07a850..6e7e527 100644 --- a/src/lib/core/download.c +++ b/src/lib/core/download.c @@ -3,6 +3,7 @@ // #include "download.h" +#include "core.h" size_t download_writer(void *fp, size_t size, size_t nmemb, void *stream) { size_t bytes = fwrite(fp, size, nmemb, (FILE *) stream); diff --git a/src/lib/core/include/core.h b/src/lib/core/include/core.h index f0586fa..35a9506 100644 --- a/src/lib/core/include/core.h +++ b/src/lib/core/include/core.h @@ -11,10 +11,6 @@ #include <time.h> #include <sys/statvfs.h> -#define SYSERROR(MSG, ...) do { \ - fprintf(stderr, "%s:%s:%d:%s - ", path_basename(__FILE__), __FUNCTION__, __LINE__, (errno > 0) ? strerror(errno) : "info"); \ - fprintf(stderr, MSG LINE_SEP, __VA_ARGS__); \ -} while (0) #define STASIS_BUFSIZ 8192 #define STASIS_NAME_MAX 255 #define STASIS_DIRSTACK_MAX 1024 @@ -23,6 +19,7 @@ #include "config.h" #include "core_mem.h" +#include "core_message.h" #define COE_CHECK_ABORT(COND, MSG) \ do {\ diff --git a/src/lib/core/include/core_message.h b/src/lib/core/include/core_message.h new file mode 100644 index 0000000..1ffa846 --- /dev/null +++ b/src/lib/core/include/core_message.h @@ -0,0 +1,19 @@ + +#ifndef STASIS_CORE_MESSAGE_H +#define STASIS_CORE_MESSAGE_H + +#define SYSERROR(MSG, ...) do { \ + fprintf(stderr, "%s:%d:%s():%s - ", path_basename(__FILE__), __LINE__, __FUNCTION__, (errno > 0) ? strerror(errno) : "info"); \ + fprintf(stderr, MSG LINE_SEP, __VA_ARGS__); \ +} while (0) + +#ifdef DEBUG +#define SYSDEBUG(MSG, ...) do { \ + fprintf(stderr, "DEBUG: %s:%d:%s(): ", path_basename(__FILE__), __LINE__, __FUNCTION__); \ + fprintf(stderr, MSG LINE_SEP, __VA_ARGS__); \ +} while (0) +#else +#define SYSDEBUG(MSG, ...) do {} while (0) +#endif + +#endif //STASIS_CORE_MESSAGE_H |