Title: [285188] trunk/Source/WTF
Revision
285188
Author
ddkil...@apple.com
Date
2021-11-02 15:19:22 -0700 (Tue, 02 Nov 2021)

Log Message

[WTF] Minor clean-up for format-related functions
<https://webkit.org/b/232514>

Reviewed by Yusuke Suzuki.

* wtf/Assertions.cpp:
(WTF::createWithFormatAndArguments):
- Put WTF_ATTRIBUTE_PRINTF() on its own line to match other
  functions.
(WTF::vprintf_stderr_with_prefix):
(WTF::vprintf_stderr_with_trailing_newline):
- Move ALLOW_NONLITERAL_FORMAT_{BEGIN,END} around specific
  function calls that need them.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (285187 => 285188)


--- trunk/Source/WTF/ChangeLog	2021-11-02 22:09:25 UTC (rev 285187)
+++ trunk/Source/WTF/ChangeLog	2021-11-02 22:19:22 UTC (rev 285188)
@@ -1,3 +1,19 @@
+2021-11-02  David Kilzer  <ddkil...@apple.com>
+
+        [WTF] Minor clean-up for format-related functions
+        <https://webkit.org/b/232514>
+
+        Reviewed by Yusuke Suzuki.
+
+        * wtf/Assertions.cpp:
+        (WTF::createWithFormatAndArguments):
+        - Put WTF_ATTRIBUTE_PRINTF() on its own line to match other
+          functions.
+        (WTF::vprintf_stderr_with_prefix):
+        (WTF::vprintf_stderr_with_trailing_newline):
+        - Move ALLOW_NONLITERAL_FORMAT_{BEGIN,END} around specific
+          function calls that need them.
+
 2021-11-02  Michael Catanzaro  <mcatanz...@gnome.org>
 
         Fails to execute _javascript_ when soft stack limit is unlimited

Modified: trunk/Source/WTF/wtf/Assertions.cpp (285187 => 285188)


--- trunk/Source/WTF/wtf/Assertions.cpp	2021-11-02 22:09:25 UTC (rev 285187)
+++ trunk/Source/WTF/wtf/Assertions.cpp	2021-11-02 22:19:22 UTC (rev 285188)
@@ -69,7 +69,8 @@
 
 namespace WTF {
 
-WTF_ATTRIBUTE_PRINTF(1, 0) static String createWithFormatAndArguments(const char* format, va_list args)
+WTF_ATTRIBUTE_PRINTF(1, 0)
+static String createWithFormatAndArguments(const char* format, va_list args)
 {
     va_list argsCopy;
     va_copy(argsCopy, args);
@@ -182,8 +183,6 @@
     vfprintf(stderr, format, args);
 }
 
-ALLOW_NONLITERAL_FORMAT_BEGIN
-
 WTF_ATTRIBUTE_PRINTF(2, 0)
 static void vprintf_stderr_with_prefix(const char* prefix, const char* format, va_list args)
 {
@@ -194,7 +193,9 @@
     memcpy(formatWithPrefix.data() + prefixLength, format, formatLength);
     formatWithPrefix[prefixLength + formatLength] = 0;
 
+    ALLOW_NONLITERAL_FORMAT_BEGIN
     vprintf_stderr_common(formatWithPrefix.data(), args);
+    ALLOW_NONLITERAL_FORMAT_END
 }
 
 WTF_ATTRIBUTE_PRINTF(1, 0)
@@ -211,11 +212,11 @@
     formatWithNewline[formatLength] = '\n';
     formatWithNewline[formatLength + 1] = 0;
 
+    ALLOW_NONLITERAL_FORMAT_BEGIN
     vprintf_stderr_common(formatWithNewline.data(), args);
+    ALLOW_NONLITERAL_FORMAT_END
 }
 
-ALLOW_NONLITERAL_FORMAT_END
-
 WTF_ATTRIBUTE_PRINTF(1, 2)
 static void printf_stderr_common(const char* format, ...)
 {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to