]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Common source file changes not directly applicable to open-vm-tools.
authorOliver Kurth <okurth@vmware.com>
Thu, 3 Oct 2019 00:48:35 +0000 (17:48 -0700)
committerOliver Kurth <okurth@vmware.com>
Thu, 3 Oct 2019 00:48:35 +0000 (17:48 -0700)
open-vm-tools/lib/stubs/stub-log.c

index fd5c107abf23abf5f1704e3a8017361a14cfc945..d76ae0266e9c976aa2b29513242c9023d641b913 100644 (file)
 #include <ctype.h>
 #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
+