bug 801466 - part 1 - remove uses of prmem in layout/ xpcom/ and modules/ r=roc

This commit is contained in:
Trevor Saunders 2012-12-03 16:18:36 -05:00
parent 666cdf4948
commit 98cecccb20
5 changed files with 12 additions and 17 deletions

View File

@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifdef IBMBIDI
#include "prmem.h"
#include "nsBidi.h"
#include "nsUnicodeProperties.h"
#include "nsCRT.h"
@ -192,7 +191,7 @@ bool nsBidi::GetMemory(void **aMemory, size_t *aSize, bool aMayAllocate, size_t
if(!aMayAllocate) {
return false;
} else {
*aMemory=PR_MALLOC(aSizeNeeded);
*aMemory=moz_malloc(aSizeNeeded);
if (*aMemory!=NULL) {
*aSize=aSizeNeeded;
return true;
@ -208,7 +207,7 @@ bool nsBidi::GetMemory(void **aMemory, size_t *aSize, bool aMayAllocate, size_t
return false;
} else if(aSizeNeeded!=*aSize && aMayAllocate) {
/* we may try to grow or shrink */
void *memory=PR_REALLOC(*aMemory, aSizeNeeded);
void *memory=moz_realloc(*aMemory, aSizeNeeded);
if(memory!=NULL) {
*aMemory=memory;
@ -227,9 +226,12 @@ bool nsBidi::GetMemory(void **aMemory, size_t *aSize, bool aMayAllocate, size_t
void nsBidi::Free()
{
PR_FREEIF(mDirPropsMemory);
PR_FREEIF(mLevelsMemory);
PR_FREEIF(mRunsMemory);
moz_free(mDirPropsMemory);
mDirPropsMemory = nullptr;
moz_free(mLevelsMemory);
mLevelsMemory = nullptr;
moz_free(mRunsMemory);
mRunsMemory = nullptr;
}
/* SetPara ------------------------------------------------------------ */

View File

@ -12,7 +12,6 @@
#include "nsDebug.h"
#include "nsTArray.h"
#include "nsTHashtable.h"
#include "prmem.h"
#include "prinit.h"
#include "prlog.h"
#include "nsArenaMemoryStats.h"
@ -471,12 +470,12 @@ struct nsPresArena::State
void* Allocate(uint32_t /* unused */, size_t aSize)
{
return PR_Malloc(aSize);
return moz_malloc(aSize);
}
void Free(uint32_t /* unused */, void* aPtr)
{
PR_Free(aPtr);
moz_free(aPtr);
}
};

View File

@ -10,7 +10,6 @@
#include "nsReadableUtils.h"
#include "nsIWindowWatcher.h"
#include "nsVoidArray.h"
#include "prmem.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeNode.h"
#include "nsPIDOMWindow.h"

View File

@ -30,7 +30,6 @@
#include "nsAutoPtr.h"
#include "nsQuickSort.h"
#include "prmem.h"
#include "pldhash.h"
#include "prefapi.h"
@ -753,10 +752,8 @@ Preferences::WritePrefFile(nsIFile* aFile)
if (NS_FAILED(rv))
return rv;
char** valueArray = (char **)PR_Calloc(sizeof(char *), gHashTable.entryCount);
if (!valueArray)
return NS_ERROR_OUT_OF_MEMORY;
nsAutoArrayPtr<char*> valueArray(new char*[gHashTable.entryCount]);
memset(valueArray, 0, gHashTable.entryCount * sizeof(char*));
pref_saveArgs saveArgs;
saveArgs.prefArray = valueArray;
saveArgs.saveTypes = SAVE_ALL;
@ -778,7 +775,6 @@ Preferences::WritePrefFile(nsIFile* aFile)
NS_Free(*walker);
}
}
PR_Free(valueArray);
// tell the safe output stream to overwrite the real prefs file
// (it'll abort if there were any errors during writing)

View File

@ -15,7 +15,6 @@
*/
#include <string.h>
#include "prmem.h"
#include "prlog.h"
#include "nsHashtable.h"
#include "nsReadableUtils.h"