]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
debug printf: Windows path separator
authorMatthew Barr <matthew.barr@intel.com>
Mon, 9 May 2016 00:53:54 +0000 (10:53 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Tue, 24 May 2016 01:26:31 +0000 (11:26 +1000)
src/ue2common.h

index b279f81a574a777f75bc1845f2ee6888cab4af52..2de607532e36646bada59a9dc78e8ff02bcb54e2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -194,12 +194,20 @@ typedef u32 ReportID;
 #define unlikely(x)    (x)
 #endif
 
+#if !defined(RELEASE_BUILD) || defined(DEBUG)
+#ifdef _WIN32
+#define PATH_SEP '\\'
+#else
+#define PATH_SEP '/'
+#endif
+#endif
+
 #if defined(DEBUG) && !defined(DEBUG_PRINTF)
 #include <string.h>
 #include <stdio.h>
 #define DEBUG_PRINTF(format, ...) printf("%s:%s:%d:" format, \
-                                         strrchr(__FILE__, '/') + 1, __func__, \
-                                         __LINE__,  ## __VA_ARGS__)
+                                         strrchr(__FILE__, PATH_SEP) + 1, \
+                                         __func__, __LINE__,  ## __VA_ARGS__)
 #elif !defined(DEBUG_PRINTF)
 #define DEBUG_PRINTF(format, ...) do { } while(0)
 #endif
@@ -208,8 +216,8 @@ typedef u32 ReportID;
 #include <string.h>
 #include <stdio.h>
 #define ADEBUG_PRINTF(format, ...) printf("!%s:%s:%d:" format, \
-                                         strrchr(__FILE__, '/') + 1, __func__, \
-                                         __LINE__,  ## __VA_ARGS__)
+                                          strrchr(__FILE__, PATH_SEP) + 1, \
+                                          __func__, __LINE__,  ## __VA_ARGS__)
 #else
 #define ADEBUG_PRINTF(format, ...) do { } while(0)
 #endif