From: Oliver Kurth Date: Thu, 3 Oct 2019 00:48:35 +0000 (-0700) Subject: Common source file changes not directly applicable to open-vm-tools. X-Git-Tag: stable-11.1.0~209 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51d83c3e9e6c0cbdc644ad5998e1f252ab8f15e9;p=thirdparty%2Fopen-vm-tools.git Common source file changes not directly applicable to open-vm-tools. --- diff --git a/open-vm-tools/lib/stubs/stub-log.c b/open-vm-tools/lib/stubs/stub-log.c index fd5c107ab..d76ae0266 100644 --- a/open-vm-tools/lib/stubs/stub-log.c +++ b/open-vm-tools/lib/stubs/stub-log.c @@ -29,15 +29,17 @@ #include #include "str.h" #include "log.h" - +#include "dynbuf.h" +#include "util.h" +#include "strutil.h" /* * XXX: the check is a hack to work around stupid libraries, like * bora/lib/install, that provide implementations for only some of * the functions of the real library, but not all. */ -#if !defined(NO_LOG_STUB) +#if !defined(NO_LOG_STUB) void LogV(uint32 unused, const char *fmt, @@ -117,8 +119,6 @@ Log_HexDump(const char *prefix, // IN: prefix for each log line Log_HexDumpLevel(VMW_LOG_INFO, prefix, data, size); } -#endif - void Log_DisableThrottling(void) @@ -132,3 +132,46 @@ Log_GetFileName(void) { return NULL; } + + +void * +Log_BufBegin(void) +{ + DynBuf *b = Util_SafeCalloc(1, sizeof *b); + + DynBuf_Init(b); + + return b; +} + +void +Log_BufAppend(void *acc, + const char *fmt, + ...) +{ + va_list args; + Bool success; + + ASSERT(acc != NULL); + ASSERT(fmt != NULL); + + va_start(args, fmt); + success = StrUtil_VDynBufPrintf((DynBuf *) acc, fmt, args); + va_end(args); + + VERIFY(success); +} + +void +Log_BufEndLevel(void *acc, + uint32 routing) +{ + ASSERT(acc != NULL); + + Log_Level(routing, "%s", (char *) DynBuf_Get((DynBuf *) acc)); + + DynBuf_Destroy((DynBuf *) acc); +} + +#endif +