Bug 1381727 (part 2) - Remove SmprintfFree(). r=glandium.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 25 Jul 2017 09:09:25 +1000
changeset 419701 b441867efe7020c53e344e53200bc2915e854487
parent 419700 edded26e7141609581dfabd39298af699ab3abd6
child 419702 49b4b43ce3a7b559fd7b33b0fe3c171b72c2cceb
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1381727
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1381727 (part 2) - Remove SmprintfFree(). r=glandium. It's just a complex wrapper for free(), or equivalent function. (In practice, all the uses end up in free().)
dom/plugins/base/nsPluginsDirWin.cpp
mozglue/misc/Printf.h
toolkit/crashreporter/nsExceptionHandler.cpp
xpcom/threads/nsEnvironment.cpp
--- a/dom/plugins/base/nsPluginsDirWin.cpp
+++ b/dom/plugins/base/nsPluginsDirWin.cpp
@@ -419,14 +419,14 @@ nsresult nsPluginFile::FreePluginInfo(ns
 
   if (info.fFullPath)
     PL_strfree(info.fFullPath);
 
   if (info.fFileName)
     PL_strfree(info.fFileName);
 
   if (info.fVersion)
-    mozilla::SmprintfFree(info.fVersion);
+    free(info.fVersion);
 
   ZeroMemory((void *)&info, sizeof(info));
 
   return NS_OK;
 }
--- a/mozglue/misc/Printf.h
+++ b/mozglue/misc/Printf.h
@@ -249,21 +249,11 @@ SmprintfPolicyPointer<AllocPolicy> Vsmpr
                                                    const char* fmt, va_list ap)
 {
     SprintfState<AllocPolicy> ss(last.release());
     if (!ss.vprint(fmt, ap))
         return nullptr;
     return ss.release();
 }
 
-/*
-** Free the memory allocated, for the caller, by Smprintf.
-*/
-template<typename AllocPolicy = mozilla::MallocAllocPolicy>
-void SmprintfFree(char* mem)
-{
-    AllocPolicy allocator;
-    allocator.free_(mem);
-}
-
 } // namespace mozilla
 
 #endif /* mozilla_Printf_h */
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -3574,17 +3574,17 @@ OOPDeinit()
 
   delete dumpMapLock;
   dumpMapLock = nullptr;
 
   delete pidToMinidump;
   pidToMinidump = nullptr;
 
 #if defined(XP_WIN) || defined(XP_MACOSX)
-  mozilla::SmprintfFree(childCrashNotifyPipe);
+  free(childCrashNotifyPipe);
   childCrashNotifyPipe = nullptr;
 #endif
 }
 
 #if defined(XP_WIN) || defined(XP_MACOSX)
 // Parent-side API for children
 const char*
 GetChildNotificationPipe()
--- a/xpcom/threads/nsEnvironment.cpp
+++ b/xpcom/threads/nsEnvironment.cpp
@@ -149,15 +149,15 @@ nsEnvironment::Set(const nsAString& aNam
                                               nativeName.get(),
                                               nativeVal.get());
   if (!newData) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   PR_SetEnv(newData.get());
   if (entry->mData) {
-    mozilla::SmprintfFree(entry->mData);
+    free(entry->mData);
   }
   entry->mData = newData.release();
   return NS_OK;
 }