Title: [242075] trunk/Source/WTF
Revision
242075
Author
[email protected]
Date
2019-02-25 22:44:06 -0800 (Mon, 25 Feb 2019)

Log Message

Fix WTFLogVerbose variadic parameters forwarding
https://bugs.webkit.org/show_bug.cgi?id=194920

Reviewed by Alex Christensen.

WTFLogVerbose was passing the va_list to WTFLog but this function
also used variadic parameters and this is not allowed in C (that
part of the code is extern "C").

* wtf/Assertions.cpp:
(WTF::WTFLogVaList): Created to take a va_list argument instead of
variadic parameters.
(WTF::WTFLog): Kept with variadic parameters, which are
transformed to va_list and passed to WTFLogVaList.
(WTF::WTFLogVerbose): Use WTFLogVaList instead of WTFLog.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (242074 => 242075)


--- trunk/Source/WTF/ChangeLog	2019-02-26 06:39:27 UTC (rev 242074)
+++ trunk/Source/WTF/ChangeLog	2019-02-26 06:44:06 UTC (rev 242075)
@@ -1,3 +1,21 @@
+2019-02-25  Xabier Rodriguez Calvar  <[email protected]>
+
+        Fix WTFLogVerbose variadic parameters forwarding
+        https://bugs.webkit.org/show_bug.cgi?id=194920
+
+        Reviewed by Alex Christensen.
+
+        WTFLogVerbose was passing the va_list to WTFLog but this function
+        also used variadic parameters and this is not allowed in C (that
+        part of the code is extern "C").
+
+        * wtf/Assertions.cpp:
+        (WTF::WTFLogVaList): Created to take a va_list argument instead of
+        variadic parameters.
+        (WTF::WTFLog): Kept with variadic parameters, which are
+        transformed to va_list and passed to WTFLogVaList.
+        (WTF::WTFLogVerbose): Use WTFLogVaList instead of WTFLog.
+
 2019-02-25  Sam Weinig  <[email protected]>
 
         Update double-conversion to the latest version

Modified: trunk/Source/WTF/wtf/Assertions.cpp (242074 => 242075)


--- trunk/Source/WTF/wtf/Assertions.cpp	2019-02-26 06:39:27 UTC (rev 242074)
+++ trunk/Source/WTF/wtf/Assertions.cpp	2019-02-26 06:44:06 UTC (rev 242075)
@@ -430,30 +430,22 @@
     va_end(args);
 }
 
-void WTFLog(WTFLogChannel* channel, const char* format, ...)
+static void WTFLogVaList(WTFLogChannel* channel, const char* format, va_list args)
 {
     if (channel->state == WTFLogChannelOff)
         return;
 
     if (channel->state == WTFLogChannelOn) {
-        va_list args;
-        va_start(args, format);
         vprintf_stderr_with_trailing_newline(format, args);
-        va_end(args);
         return;
     }
 
     ASSERT(channel->state == WTFLogChannelOnWithAccumulation);
 
-    va_list args;
-    va_start(args, format);
-
     ALLOW_NONLITERAL_FORMAT_BEGIN
     String loggingString = WTF::createWithFormatAndArguments(format, args);
     ALLOW_NONLITERAL_FORMAT_END
 
-    va_end(args);
-
     if (!loggingString.endsWith('\n'))
         loggingString.append('\n');
 
@@ -462,6 +454,16 @@
     logToStderr(loggingString.utf8().data());
 }
 
+void WTFLog(WTFLogChannel* channel, const char* format, ...)
+{
+    va_list args;
+    va_start(args, format);
+
+    WTFLogVaList(channel, format, args);
+
+    va_end(args);
+}
+
 void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChannel* channel, const char* format, ...)
 {
     if (channel->state != WTFLogChannelOn)
@@ -471,7 +473,7 @@
     va_start(args, format);
 
     ALLOW_NONLITERAL_FORMAT_BEGIN
-    WTFLog(channel, format, args);
+    WTFLogVaList(channel, format, args);
     ALLOW_NONLITERAL_FORMAT_END
 
     va_end(args);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to