From: Oliver Kurth Date: Wed, 22 Jan 2020 19:30:44 +0000 (-0800) Subject: More LOG() calls changed to variadic form. X-Git-Tag: stable-11.1.0~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87b56217cb3f1fd5cc9945304d3dac9465490c96;p=thirdparty%2Fopen-vm-tools.git More LOG() calls changed to variadic form. --- diff --git a/open-vm-tools/lib/include/vixOpenSource.h b/open-vm-tools/lib/include/vixOpenSource.h index 4b142b42a..6f3b2079d 100644 --- a/open-vm-tools/lib/include/vixOpenSource.h +++ b/open-vm-tools/lib/include/vixOpenSource.h @@ -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__))