]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
More LOG() calls changed to variadic form.
authorOliver Kurth <okurth@vmware.com>
Wed, 22 Jan 2020 19:30:44 +0000 (11:30 -0800)
committerOliver Kurth <okurth@vmware.com>
Wed, 22 Jan 2020 19:30:44 +0000 (11:30 -0800)
open-vm-tools/lib/include/vixOpenSource.h

index 4b142b42ac4c135e03d1b0be0fcae60b35341701..6f3b2079d2387961240bf224dbf9e92e62383829 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2007-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 2007-2020 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -680,11 +680,11 @@ typedef enum VixRegValueDataType {
  *
  *      Use as:
  *
- *      VIX_DEBUG(("test debug message: %s %d\n", stringArg, intArg));
+ *      VIX_DEBUG("test debug message: %s %d\n", stringArg, intArg);
  *
  *       Output will go to logfile if VIX_DEBUG_PREFERENCE_NAME is non-zero
  *
- *      VIX_DEBUG_LEVEL(3, ("test debug message: %s %d\n", stringArg, intArg));
+ *      VIX_DEBUG_LEVEL(3, "test debug message: %s %d\n", stringArg, intArg);
  *
  *       Output will go to logfile if VIX_DEBUG_PREFERENCE_NAME is >=
  *       the first argument to the macro.
@@ -732,31 +732,47 @@ extern VixError VixLogError(VixError err, const char *function, int line,
 #define DEFAULT_VIX_LOG_LEVEL    0
 #define DEFAULT_VIX_API_TRACE_LEVEL 0
 
-#define VIX_DEBUG_LEVEL(logLevel, s) if (logLevel <= vixDebugGlobalSpewLevel) \
-    {  char *debugString = VixAllocDebugString s; \
-       Log("Vix: [%s:%d]: %s", \
-           VixDebug_GetFileBaseName(__FILE__), __LINE__, debugString); \
-       free(debugString); }
-
-#define VIX_DEBUG(s) if (0 != vixDebugGlobalSpewLevel) \
-    {  char *debugString = VixAllocDebugString s; \
-       Log("Vix: [%s:%d]: %s", \
-           VixDebug_GetFileBaseName(__FILE__), __LINE__, debugString); \
-       free(debugString); }
-
-#define VIX_DEBUG_ALWAYS(s) {  char *debugString = VixAllocDebugString s; \
-       Log("Vix: [%s:%d]: %s", \
-           VixDebug_GetFileBaseName(__FILE__), __LINE__, debugString); \
-       free(debugString); }
+#define VIX_DEBUG_LEVEL(logLevel, ...)                       \
+   if (logLevel <= vixDebugGlobalSpewLevel) {                \
+      char *debugString = VixAllocDebugString(__VA_ARGS__);  \
+                                                             \
+      Log("Vix: [%s:%d]: %s",                                \
+          VixDebug_GetFileBaseName(__FILE__), __LINE__,      \
+          debugString);                                      \
+      free(debugString);                                     \
+   }
+
+#define VIX_DEBUG(...)                                       \
+   if (0 != vixDebugGlobalSpewLevel) {                       \
+      char *debugString = VixAllocDebugString(__VA_ARGS__);  \
+                                                             \
+      Log("Vix: [%s:%d]: %s",                                \
+          VixDebug_GetFileBaseName(__FILE__), __LINE__,      \
+          debugString);                                      \
+      free(debugString);                                     \
+   }
+
+#define VIX_DEBUG_ALWAYS(...)                                \
+   {                                                         \
+      char *debugString = VixAllocDebugString(__VA_ARGS__);  \
+                                                             \
+      Log("Vix: [%s:%d]: %s",                                \
+          VixDebug_GetFileBaseName(__FILE__), __LINE__,      \
+          debugString);                                      \
+       free(debugString);                                    \
+    }
 
 #define VIX_API_TRACE_ON() (vixApiTraceGlobalSpewLevel > 0)
 
-#define VIX_API_LOG(s) if (VIX_API_TRACE_ON())                       \
-    {  char *debugString = VixAllocDebugString s;                    \
-       Log("VixApiLog: %s %s\n", __FUNCTION__, debugString);         \
-       free(debugString); }
+#define VIX_API_LOG(...)                                     \
+   if (VIX_API_TRACE_ON()) {                                 \
+      char *debugString = VixAllocDebugString(__VA_ARGS__);  \
+                                                             \
+      Log("VixApiLog: %s %s\n", __FUNCTION__, debugString);  \
+      free(debugString);                                     \
+   }
 
-// If no MSG is given, a description of err is suplemented.
+// If no MSG is given, a description of err is supplemented.
 #define VIX_ERROR(err) (VIX_ERROR_MSG(err, NULL))
 #define VIX_ERROR_MSG(err, ...) (VixLogError(err, __FUNCTION__, __LINE__, \
       VixDebug_GetFileBaseName(__FILE__), __VA_ARGS__))