Bug 1060419 - make mozStorageConnection.cpp and mozStorageStatement.cpp use Printf.h, r=froydnj
authorTom Tromey <tom@tromey.com>
Fri, 09 Dec 2016 10:27:17 -1000
changeset 372566 da6402c01d46b5dc7249dc3ec5c29c05122caa9c
parent 372565 d7cebacb1f7c0073fcb39596aead124d3aa6c15d
child 372567 6d9d0198ed9d1ff71465a7a65d8f4f4969cc7e0c
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 mozStorageConnection.cpp and mozStorageStatement.cpp use Printf.h, r=froydnj MozReview-Commit-ID: Gy2CLg9AVpG
storage/mozStorageConnection.cpp
storage/mozStorageStatement.cpp
--- a/storage/mozStorageConnection.cpp
+++ b/storage/mozStorageConnection.cpp
@@ -36,17 +36,17 @@
 #include "mozStorageStatementData.h"
 #include "StorageBaseStatementInternal.h"
 #include "SQLCollations.h"
 #include "FileSystemModule.h"
 #include "mozStorageHelper.h"
 #include "GeckoProfiler.h"
 
 #include "mozilla/Logging.h"
-#include "prprf.h"
+#include "mozilla/Printf.h"
 #include "nsProxyRelease.h"
 #include <algorithm>
 
 #define MIN_AVAILABLE_BYTES_PER_CHUNKED_GROWTH 524288000 // 500 MiB
 
 // Maximum size of the pages cache per connection.
 #define MAX_CACHE_SIZE_KIBIBYTES 2048 // 2 MiB
 
@@ -996,38 +996,38 @@ Connection::internalClose(sqlite3 *aNati
   int srv = sqlite3_close(aNativeConnection);
 
   if (srv == SQLITE_BUSY) {
     // We still have non-finalized statements. Finalize them.
 
     sqlite3_stmt *stmt = nullptr;
     while ((stmt = ::sqlite3_next_stmt(aNativeConnection, stmt))) {
       MOZ_LOG(gStorageLog, LogLevel::Debug,
-             ("Auto-finalizing SQL statement '%s' (%x)",
+             ("Auto-finalizing SQL statement '%s' (%p)",
               ::sqlite3_sql(stmt),
               stmt));
 
 #ifdef DEBUG
-      char *msg = ::PR_smprintf("SQL statement '%s' (%x) should have been finalized before closing the connection",
-                                ::sqlite3_sql(stmt),
-                                stmt);
+      char *msg = ::mozilla::Smprintf("SQL statement '%s' (%p) should have been finalized before closing the connection",
+                               ::sqlite3_sql(stmt),
+                               stmt);
       NS_WARNING(msg);
-      ::PR_smprintf_free(msg);
+      ::mozilla::SmprintfFree(msg);
       msg = nullptr;
 #endif // DEBUG
 
       srv = ::sqlite3_finalize(stmt);
 
 #ifdef DEBUG
       if (srv != SQLITE_OK) {
-        msg = ::PR_smprintf("Could not finalize SQL statement '%s' (%x)",
-                            ::sqlite3_sql(stmt),
-                            stmt);
+        msg = ::mozilla::Smprintf("Could not finalize SQL statement '%s' (%p)",
+                           ::sqlite3_sql(stmt),
+                           stmt);
         NS_WARNING(msg);
-        ::PR_smprintf_free(msg);
+        ::mozilla::SmprintfFree(msg);
         msg = nullptr;
       }
 #endif // DEBUG
 
       // Ensure that the loop continues properly, whether closing has succeeded
       // or not.
       if (srv == SQLITE_OK) {
         stmt = nullptr;
@@ -1811,22 +1811,22 @@ Connection::rollbackTransactionInternal(
 }
 
 NS_IMETHODIMP
 Connection::CreateTable(const char *aTableName,
                         const char *aTableSchema)
 {
   if (!mDBConn) return NS_ERROR_NOT_INITIALIZED;
 
-  char *buf = ::PR_smprintf("CREATE TABLE %s (%s)", aTableName, aTableSchema);
+  char *buf = ::mozilla::Smprintf("CREATE TABLE %s (%s)", aTableName, aTableSchema);
   if (!buf)
     return NS_ERROR_OUT_OF_MEMORY;
 
   int srv = executeSql(mDBConn, buf);
-  ::PR_smprintf_free(buf);
+  ::mozilla::SmprintfFree(buf);
 
   return convertResultCode(srv);
 }
 
 NS_IMETHODIMP
 Connection::CreateFunction(const nsACString &aFunctionName,
                            int32_t aNumArguments,
                            mozIStorageFunction *aFunction)
--- a/storage/mozStorageStatement.cpp
+++ b/storage/mozStorageStatement.cpp
@@ -21,16 +21,17 @@
 #include "mozStoragePrivateHelpers.h"
 #include "mozStorageStatementParams.h"
 #include "mozStorageStatementRow.h"
 #include "mozStorageStatement.h"
 #include "GeckoProfiler.h"
 #include "nsDOMClassInfo.h"
 
 #include "mozilla/Logging.h"
+#include "mozilla/Printf.h"
 
 
 extern mozilla::LazyLogModule gStorageLog;
 
 namespace mozilla {
 namespace storage {
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -376,17 +377,17 @@ Statement::internalFinalize(bool aDestru
     //
     // The database connection is either closed or closing. The sqlite
     // statement has either been finalized already by the connection
     // or is about to be finalized by the connection.
     //
     // Finalizing it here would be useless and segfaultish.
     //
 
-    char *msg = ::PR_smprintf("SQL statement (%x) should have been finalized"
+    char *msg = ::mozilla::Smprintf("SQL statement (%p) should have been finalized"
       " before garbage-collection. For more details on this statement, set"
       " NSPR_LOG_MESSAGES=mozStorage:5 .",
       mDBStatement);
 
     //
     // Note that we can't display the statement itself, as the data structure
     // is not valid anymore. However, the address shown here should help
     // developers correlate with the more complete debug message triggered
@@ -396,17 +397,17 @@ Statement::internalFinalize(bool aDestru
 #if 0
     // Deactivate the warning until we have fixed the exising culprit
     // (see bug 914070).
     NS_WARNING(msg);
 #endif // 0
 
     MOZ_LOG(gStorageLog, LogLevel::Warning, (msg));
 
-    ::PR_smprintf_free(msg);
+    ::mozilla::SmprintfFree(msg);
   }
 
 #endif
 
   mDBStatement = nullptr;
 
   if (mAsyncStatement) {
     // If the destructor called us, there are no pending async statements (they