]> Devoid-pointer.net GitWeb - libHPCS.git/commitdiff
- Prepend function name to PR_DEBUG output
authorMichal Malý <madcatxster@devoid-pointer.net>
Thu, 10 Jul 2014 23:13:08 +0000 (01:13 +0200)
committerMichal Malý <madcatxster@devoid-pointer.net>
Thu, 10 Jul 2014 23:13:08 +0000 (01:13 +0200)
- Provide fully flexible PR_DEBUGF

libhpcs.c
libhpcs_p.h

index 92ca9d22943d236b83953ba067d9bc80020b9705..81510b2d645f1f00f7b10258263cb40801213f48 100644 (file)
--- a/libhpcs.c
+++ b/libhpcs.c
@@ -527,7 +527,7 @@ static enum HPCS_ParseCode read_fixed_signal(FILE* datafile, struct HPCS_TVPair*
                                read_file = false;
                                break;
                        default:
-                               PR_DEBUG("Marker was expected but it was not found\n");
+                               PR_DEBUGF("%s %lu\n", "Marker was expected but it was not found at:", segments_read);
                                free(*pairs);
                                *pairs = NULL;
                                return PARSE_E_NOT_FOUND;
index eb4495a3eba895470add0037180bfe20c3f13e97..a1fde65776be65c34ff51843d4ba13ca325bb548 100644 (file)
@@ -123,7 +123,12 @@ void reverse_endianness(char* bytes, size_t sz) {
 #endif
 
 #ifndef NDEBUG
-#define PR_DEBUG(msg) fprintf(stderr, msg)
+ #ifdef _MSC_VER
+ #define __func__ __FUNCTION__
+ #endif
+ #define PR_DEBUGF(fmt, ...) fprintf(stderr, "[%s()] "fmt, __func__, __VA_ARGS__)
+ #define PR_DEBUG(msg) fprintf(stderr, "[%s()] "msg, __func__)
 #else
-#define PR_DEBUG(msg)
+ #define PR_DEBUGF(fmt, msg)
+ #define PR_DEBUG(msg)
 #endif