Bug 1060419 - make xpcom/glue/nsDebug.h use Printf.h, r=froydnj
authorTom Tromey <tom@tromey.com>
Fri, 09 Dec 2016 10:50:37 -1000
changeset 372577 c6e12df0792f6c532982860663bb55a122d4f1e6
parent 372576 11812794175e5614b7025cb7a25fa7037da88890
child 372578 2e15220e1106db5066dd38402392170ad22053ed
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1060419
milestone54.0a1
Bug 1060419 - make xpcom/glue/nsDebug.h use Printf.h, r=froydnj MozReview-Commit-ID: 3nau1fJbnuX
xpcom/base/nsDebug.h
--- a/xpcom/base/nsDebug.h
+++ b/xpcom/base/nsDebug.h
@@ -11,17 +11,18 @@
 #include "nsError.h"
 
 #include "nsXPCOM.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Likely.h"
 #include <stdarg.h>
 
 #ifdef DEBUG
-#include "prprf.h"
+#include "mozilla/IntegerPrintfMacros.h"
+#include "mozilla/Printf.h"
 #endif
 
 /**
  * Warn if the given condition is true. The condition is evaluated in both
  * release and debug builds, and the result is an expression which can be
  * used in subsequent expressions, such as:
  *
  * if (NS_WARN_IF(NS_FAILED(rv)) {
@@ -285,26 +286,28 @@ inline void MOZ_PretendNoReturn()
 
 /******************************************************************************
 ** Macros for checking results
 ******************************************************************************/
 
 #if defined(DEBUG) && !defined(XPCOM_GLUE_AVOID_NSPR)
 
 #define NS_ENSURE_SUCCESS_BODY(res, ret)                                  \
-    char *msg = PR_smprintf("NS_ENSURE_SUCCESS(%s, %s) failed with "      \
-                            "result 0x%X", #res, #ret, __rv);             \
+    char *msg = mozilla::Smprintf("NS_ENSURE_SUCCESS(%s, %s) failed with "       \
+                           "result 0x%" PRIX32, #res, #ret,               \
+                           static_cast<uint32_t>(__rv));                  \
     NS_WARNING(msg);                                                      \
-    PR_smprintf_free(msg);
+    mozilla::SmprintfFree(msg);
 
 #define NS_ENSURE_SUCCESS_BODY_VOID(res)                                  \
-    char *msg = PR_smprintf("NS_ENSURE_SUCCESS_VOID(%s) failed with "     \
-                            "result 0x%X", #res, __rv);                   \
+    char *msg = mozilla::Smprintf("NS_ENSURE_SUCCESS_VOID(%s) failed with "      \
+                           "result 0x%" PRIX32, #res,                     \
+                           static_cast<uint32_t>(__rv));                  \
     NS_WARNING(msg);                                                      \
-    PR_smprintf_free(msg);
+    mozilla::SmprintfFree(msg);
 
 #else
 
 #define NS_ENSURE_SUCCESS_BODY(res, ret)                                  \
     NS_WARNING("NS_ENSURE_SUCCESS(" #res ", " #ret ") failed");
 
 #define NS_ENSURE_SUCCESS_BODY_VOID(res)                                  \
     NS_WARNING("NS_ENSURE_SUCCESS_VOID(" #res ") failed");