Bug 1381726 - Replace nsTextFormatter::smprintf_free() uses with free(). r=jorgk
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 24 Jul 2017 19:01:11 +1000
changeset 21816 29d8abec1e2a7c69471a03b605abc89c214755d4
parent 21815 0bcc573012c9354f19de9880ea06bb8cd017278e
child 21817 8395d8712176cb6d21a0b7193faf54855c912ee6
push id13320
push usermozilla@jorgk.com
push dateWed, 26 Jul 2017 06:10:21 +0000
treeherdercomm-central@29d8abec1e2a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorgk
bugs1381726
Bug 1381726 - Replace nsTextFormatter::smprintf_free() uses with free(). r=jorgk
mailnews/base/search/src/nsMsgFilterList.cpp
mailnews/compose/src/nsSmtpProtocol.cpp
mailnews/import/outlook/src/nsOutlookImport.cpp
mailnews/import/src/nsImportAddressBooks.cpp
mailnews/import/src/nsImportMail.cpp
mailnews/import/text/src/nsTextImport.cpp
mailnews/import/vcard/src/nsVCardImport.cpp
mailnews/import/winlivemail/nsWMImport.cpp
mailnews/local/src/nsPop3Protocol.cpp
mailnews/mime/emitters/nsMimeBaseEmitter.cpp
--- a/mailnews/base/search/src/nsMsgFilterList.cpp
+++ b/mailnews/base/search/src/nsMsgFilterList.cpp
@@ -577,17 +577,17 @@ nsresult nsMsgFilterList::LoadTextFilter
           filter->SetFilterName(unicodeStr);
         }
         else
         {
           // ### fix me - this is silly.
           char16_t *unicodeString =
             nsTextFormatter::smprintf(unicodeFormatter, value.get());
           filter->SetFilterName(nsDependentString(unicodeString));
-          nsTextFormatter::smprintf_free(unicodeString);
+          free(unicodeString);
         }
         m_curFilter = filter;
         m_filters.AppendElement(filter);
       }
       break;
     case nsIMsgFilterList::attribEnabled:
       if (m_curFilter)
         m_curFilter->SetEnabled(StrToBool(value));
--- a/mailnews/compose/src/nsSmtpProtocol.cpp
+++ b/mailnews/compose/src/nsSmtpProtocol.cpp
@@ -129,17 +129,17 @@ nsresult nsExplainErrorDetails(nsISmtpUr
   }
 #ifdef __GNUC__
 #pragma GCC diagnostic pop
 #endif
 
   if (msg)
   {
     rv = dialog->Alert(nullptr, msg);
-    nsTextFormatter::smprintf_free(msg);
+    free(msg);
   }
 
   va_end (args);
 
   return rv;
 }
 
 /* RFC 1891 -- extended smtp value encoding scheme
--- a/mailnews/import/outlook/src/nsOutlookImport.cpp
+++ b/mailnews/import/outlook/src/nsOutlookImport.cpp
@@ -346,30 +346,30 @@ void ImportOutlookMailImpl::AddLinebreak
 void ImportOutlookMailImpl::ReportSuccess(nsString& name, int32_t count, nsString *pStream)
 {
   if (!pStream)
     return;
   // load the success string
   char16_t *pFmt = nsOutlookStringBundle::GetStringByID(OUTLOOKIMPORT_MAILBOX_SUCCESS);
   char16_t *pText = nsTextFormatter::smprintf(pFmt, name.get(), count);
   pStream->Append(pText);
-  nsTextFormatter::smprintf_free(pText);
+  free(pText);
   nsOutlookStringBundle::FreeString(pFmt);
   AddLinebreak(pStream);
 }
 
 void ImportOutlookMailImpl::ReportError(int32_t errorNum, nsString& name, nsString *pStream)
 {
   if (!pStream)
     return;
   // load the error string
   char16_t *pFmt = nsOutlookStringBundle::GetStringByID(errorNum);
   char16_t *pText = nsTextFormatter::smprintf(pFmt, name.get());
   pStream->Append(pText);
-  nsTextFormatter::smprintf_free(pText);
+  free(pText);
   nsOutlookStringBundle::FreeString(pFmt);
   AddLinebreak(pStream);
 }
 
 
 void ImportOutlookMailImpl::SetLogs(nsString& success, nsString& error, char16_t **pError, char16_t **pSuccess)
 {
   if (pError)
@@ -573,12 +573,12 @@ NS_IMETHODIMP ImportOutlookAddressImpl::
 void ImportOutlookAddressImpl::ReportSuccess(nsString& name, nsString *pStream)
 {
   if (!pStream)
     return;
   // load the success string
   char16_t *pFmt = nsOutlookStringBundle::GetStringByID(OUTLOOKIMPORT_ADDRESS_SUCCESS);
   char16_t *pText = nsTextFormatter::smprintf(pFmt, name.get());
   pStream->Append(pText);
-  nsTextFormatter::smprintf_free(pText);
+  free(pText);
   nsOutlookStringBundle::FreeString(pFmt);
   ImportOutlookMailImpl::AddLinebreak(pStream);
 }
--- a/mailnews/import/src/nsImportAddressBooks.cpp
+++ b/mailnews/import/src/nsImportAddressBooks.cpp
@@ -784,17 +784,17 @@ void nsImportGenericAddressBooks::Report
                                               nsIStringBundle* aBundle)
 {
   if (!pStream)
     return;
   // load the error string
   char16_t *pFmt = nsImportStringBundle::GetStringByID(IMPORT_ERROR_GETABOOK, aBundle);
   char16_t *pText = nsTextFormatter::smprintf(pFmt, pName);
   pStream->Append(pText);
-  nsTextFormatter::smprintf_free(pText);
+  free(pText);
   NS_Free(pFmt);
   pStream->AppendLiteral(MSG_LINEBREAK);
 }
 
 static void ImportAddressThread(void *stuff)
 {
   IMPORT_LOG0("In Begin ImportAddressThread\n");
 
--- a/mailnews/import/src/nsImportMail.cpp
+++ b/mailnews/import/src/nsImportMail.cpp
@@ -597,17 +597,17 @@ void nsImportGenericMail::ReportError(in
 {
   if (!pStream)
     return;
 
   // load the error string
   char16_t *pFmt = nsImportStringBundle::GetStringByID(id, aBundle);
   char16_t *pText = nsTextFormatter::smprintf(pFmt, pName);
   pStream->Append(pText);
-  nsTextFormatter::smprintf_free(pText);
+  free(pText);
   NS_Free(pFmt);
   pStream->Append(NS_ConvertASCIItoUTF16(MSG_LINEBREAK));
 }
 
 
 void nsImportGenericMail::SetLogs(nsString& success, nsString& error, nsISupportsString *pSuccess, nsISupportsString *pError)
 {
     nsAutoString str;
--- a/mailnews/import/text/src/nsTextImport.cpp
+++ b/mailnews/import/text/src/nsTextImport.cpp
@@ -334,32 +334,32 @@ void ImportAddressImpl::ReportSuccess(ns
     return;
 
   // load the success string
   char16_t *pFmt =
     nsImportStringBundle::GetStringByID(TEXTIMPORT_ADDRESS_SUCCESS, pBundle);
 
   char16_t *pText = nsTextFormatter::smprintf(pFmt, name.get());
   pStream->Append(pText);
-  nsTextFormatter::smprintf_free(pText);
+  free(pText);
   NS_Free(pFmt);
   pStream->Append(char16_t('\n'));
 }
 
 void ImportAddressImpl::ReportError(int32_t errorNum, nsString& name,
                                     nsString *pStream, nsIStringBundle* pBundle)
 {
   if (!pStream)
     return;
 
   // load the error string
   char16_t *pFmt = nsImportStringBundle::GetStringByID(errorNum, pBundle);
   char16_t *pText = nsTextFormatter::smprintf(pFmt, name.get());
   pStream->Append(pText);
-  nsTextFormatter::smprintf_free(pText);
+  free(pText);
   NS_Free(pFmt);
   pStream->Append(char16_t('\n'));
 }
 
 void ImportAddressImpl::SetLogs(nsString& success, nsString& error, char16_t **pError, char16_t **pSuccess)
 {
   if (pError)
     *pError = ToNewUnicode(error);
--- a/mailnews/import/vcard/src/nsVCardImport.cpp
+++ b/mailnews/import/vcard/src/nsVCardImport.cpp
@@ -291,33 +291,33 @@ void ImportVCardAddressImpl::ReportSucce
     return;
 
   // load the success string
   char16_t *pFmt = nsImportStringBundle::GetStringByName(
       "vCardImportAddressSuccess", pBundle);
 
   char16_t *pText = nsTextFormatter::smprintf(pFmt, name.get());
   pStream->Append(pText);
-  nsTextFormatter::smprintf_free(pText);
+  free(pText);
   NS_Free(pFmt);
   pStream->Append(char16_t('\n'));
 }
 
 void ImportVCardAddressImpl::ReportError(
     const char *errorName, nsString& name, nsString *pStream,
     nsIStringBundle* pBundle)
 {
   if (!pStream)
     return;
 
   // load the error string
   char16_t *pFmt = nsImportStringBundle::GetStringByName(errorName, pBundle);
   char16_t *pText = nsTextFormatter::smprintf(pFmt, name.get());
   pStream->Append(pText);
-  nsTextFormatter::smprintf_free(pText);
+  free(pText);
   NS_Free(pFmt);
   pStream->Append(char16_t('\n'));
 }
 
 void ImportVCardAddressImpl::SetLogs(
     nsString& success, nsString& error,
     char16_t **pError, char16_t **pSuccess)
 { 
--- a/mailnews/import/winlivemail/nsWMImport.cpp
+++ b/mailnews/import/winlivemail/nsWMImport.cpp
@@ -197,30 +197,30 @@ void ImportWMMailImpl::AddLinebreak(nsSt
 void ImportWMMailImpl::ReportSuccess(nsString& name, int32_t count, nsString *pStream)
 {
   if (!pStream)
     return;
   // load the success string
   char16_t *pFmt = nsWMStringBundle::GetStringByID(WMIMPORT_MAILBOX_SUCCESS);
   char16_t *pText = nsTextFormatter::smprintf(pFmt, name.get(), count);
   pStream->Append(pText);
-  nsTextFormatter::smprintf_free(pText);
+  free(pText);
   nsWMStringBundle::FreeString(pFmt);
   AddLinebreak(pStream);
 }
 
 void ImportWMMailImpl::ReportError(int32_t errorNum, nsString& name, nsString *pStream)
 {
   if (!pStream)
     return;
   // load the error string
   char16_t *pFmt = nsWMStringBundle::GetStringByID(errorNum);
   char16_t *pText = nsTextFormatter::smprintf(pFmt, name.get());
   pStream->Append(pText);
-  nsTextFormatter::smprintf_free(pText);
+  free(pText);
   nsWMStringBundle::FreeString(pFmt);
   AddLinebreak(pStream);
 }
 
 void ImportWMMailImpl::SetLogs(nsString& success, nsString& error,
                                char16_t **pError, char16_t **pSuccess)
 {
   if (pError)
--- a/mailnews/local/src/nsPop3Protocol.cpp
+++ b/mailnews/local/src/nsPop3Protocol.cpp
@@ -3519,17 +3519,17 @@ nsPop3Protocol::TopResponse(nsIInputStre
     if (!statusTemplate.IsEmpty())
     {
       nsAutoCString hostName;
       char16_t * statusString = nullptr;
       m_url->GetHost(hostName);
 
       statusString = nsTextFormatter::smprintf(statusTemplate.get(), hostName.get());
       UpdateStatusWithString(statusString);
-      nsTextFormatter::smprintf_free(statusString);
+      free(statusString);
     }
 
     if (m_prefAuthMethods != POP3_HAS_AUTH_USER &&
         TestCapFlag(POP3_HAS_XSENDER))
       m_pop3ConData->next_state = POP3_SEND_XSENDER;
     else
       m_pop3ConData->next_state = POP3_SEND_RETR;
     return(0);
--- a/mailnews/mime/emitters/nsMimeBaseEmitter.cpp
+++ b/mailnews/mime/emitters/nsMimeBaseEmitter.cpp
@@ -734,17 +734,17 @@ nsMimeBaseEmitter::GenerateDateString(co
       int32_t senderoffset = (explodedMsgTime.tm_params.tp_gmt_offset +
                               explodedMsgTime.tm_params.tp_dst_offset) / 60;
       // append offset to date string
       char16_t *tzstring =
         nsTextFormatter::smprintf(u" %+05d",
                                   (senderoffset / 60 * 100) +
                                   (senderoffset % 60));
       formattedDateString.Append(tzstring);
-      nsTextFormatter::smprintf_free(tzstring);
+      free(tzstring);
     }
 
     CopyUTF16toUTF8(formattedDateString, formattedDate);
   }
 
   return rv;
 }