Bug 1060419 - make ipc/chromium use Printf.h, r=froydnj
authorTom Tromey <tom@tromey.com>
Fri, 09 Dec 2016 10:16:59 -1000
changeset 372562 4d4495e4dedcd3544e28733c07c5f68c988c6f69
parent 372561 ac79a302c43013dd70f360cd768957397e2dedab
child 372563 e93b8cb7d85d486ce99ff182da592ac24afe5e39
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 ipc/chromium use Printf.h, r=froydnj MozReview-Commit-ID: 10spM5oOe5c
ipc/chromium/src/base/logging.cc
ipc/chromium/src/base/logging.h
--- a/ipc/chromium/src/base/logging.cc
+++ b/ipc/chromium/src/base/logging.cc
@@ -1,19 +1,19 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
 #include "base/logging.h"
 #include "prmem.h"
-#include "prprf.h"
 #include "base/string_util.h"
 #include "nsXPCOM.h"
+#include "mozilla/Printf.h"
 
 namespace mozilla {
 
 Logger::~Logger()
 {
   LogLevel prlevel = LogLevel::Debug;
   int xpcomlevel = -1;
 
@@ -43,25 +43,25 @@ Logger::~Logger()
     xpcomlevel = NS_DEBUG_ABORT;
     break;
   }
 
   MOZ_LOG(gChromiumPRLog, prlevel, ("%s:%i: %s", mFile, mLine, mMsg ? mMsg : "<no message>"));
   if (xpcomlevel != -1)
     NS_DebugBreak(xpcomlevel, mMsg, NULL, mFile, mLine);
 
-  PR_Free(mMsg);
+  mozilla::SmprintfFree(mMsg);
 }
 
 void
 Logger::printf(const char* fmt, ...)
 {
   va_list args;
   va_start(args, fmt);
-  mMsg = PR_vsprintf_append(mMsg, fmt, args);
+  mMsg = mozilla::VsmprintfAppend(mMsg, fmt, args);
   va_end(args);
 }
 
 LazyLogModule Logger::gChromiumPRLog("chromium");
 
 mozilla::Logger&
 operator<<(mozilla::Logger& log, const char* s)
 {
--- a/ipc/chromium/src/base/logging.h
+++ b/ipc/chromium/src/base/logging.h
@@ -6,16 +6,17 @@
 
 #ifndef BASE_LOGGING_H_
 #define BASE_LOGGING_H_
 
 #include <string>
 #include <cstring>
 
 #include "base/basictypes.h"
+#include "mozilla/Attributes.h"
 #include "mozilla/Logging.h"
 
 #ifdef NO_CHROMIUM_LOGGING
 #include <sstream>
 #endif
 
 // Replace the Chromium logging code with NSPR-based logging code and
 // some C++ wrappers to emulate std::ostream
@@ -39,17 +40,17 @@ public:
     , mFile(file)
     , mLine(line)
     , mMsg(NULL)
   { }
 
   ~Logger();
 
   // not private so that the operator<< overloads can get to it
-  void printf(const char* fmt, ...);
+  void printf(const char* fmt, ...) MOZ_FORMAT_PRINTF(2, 3);
 
 private:
   static mozilla::LazyLogModule gChromiumPRLog;
 //  static PRLogModuleInfo* GetLog();
 
   LogSeverity mSeverity;
   const char* mFile;
   int mLine;