Bug 553032 - change sprintf_append to be a varargs function; r=evilpie
☠☠ backed out by 32cd13c5b221 ☠ ☠
authorTom Tromey <tom@tromey.com>
Wed, 12 Oct 2016 12:10:40 -0600
changeset 318607 2129aca7cab2e779963fb4ca216823e5ce212ada
parent 318606 2bfd163f23f900d36262b3f8708708a86a7f8d8b
child 318608 4d1e74123ab673fa81d606b417b47797688cd501
push id20725
push userphilringnalda@gmail.com
push dateThu, 20 Oct 2016 01:36:01 +0000
treeherderfx-team@998ad5a74da8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersevilpie
bugs553032
milestone52.0a1
Bug 553032 - change sprintf_append to be a varargs function; r=evilpie MozReview-Commit-ID: I5aECiK5Coz
js/src/jsfriendapi.cpp
--- a/js/src/jsfriendapi.cpp
+++ b/js/src/jsfriendapi.cpp
@@ -758,21 +758,26 @@ FormatValue(JSContext* cx, const Value& 
     const char* found = strstr(buf, "function ");
     if (found && (found - buf <= 2))
         return "[function]";
     return buf;
 }
 
 // Wrapper for JS_sprintf_append() that reports allocation failure to the
 // context.
-template <typename... Args>
 static char*
-sprintf_append(JSContext* cx, char* buf, Args&&... args)
+MOZ_FORMAT_PRINTF(3, 4)
+sprintf_append(JSContext* cx, char* buf, const char* fmt, ...)
 {
-    char* result = JS_sprintf_append(buf, mozilla::Forward<Args>(args)...);
+    va_list ap;
+
+    va_start(ap, fmt);
+    char* result = JS_vsprintf_append(buf, fmt, ap);
+    va_end(ap);
+
     if (!result) {
         ReportOutOfMemory(cx);
         return nullptr;
     }
 
     return result;
 }