Bug 1060419 - make xpcom/glue/nsDebug.h use Printf.h, r?froydnj draft
authorTom Tromey <tom@tromey.com>
Fri, 09 Dec 2016 10:50:37 -1000
changeset 486161 354ca160d32298d44540865a6dad2722a7d347ae
parent 486160 b4379a4c931cf109a41ed9209c22112b493727c3
child 486162 447c67ec0672a013b6c4079ce80c10ba03734b5c
push id45909
push userbmo:ttromey@mozilla.com
push dateFri, 17 Feb 2017 16:00:11 +0000
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");