From 95dbf58d3733f1092e541f9c0901755f4a49f312 Mon Sep 17 00:00:00 2001 From: "waterson%netscape.com" Date: Fri, 30 Apr 1999 18:49:40 +0000 Subject: [PATCH] Bug 5671. Use nsAllocator instead of C++ new/delete. r=jband,a=chofmann. git-svn-id: svn://10.0.0.236/trunk@29860 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/string/obsolete/nsXPIDLString.cpp | 9 +++++---- mozilla/xpcom/ds/nsXPIDLString.cpp | 9 +++++---- mozilla/xpcom/src/nsXPIDLString.cpp | 9 +++++---- mozilla/xpcom/string/obsolete/nsXPIDLString.cpp | 9 +++++---- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/mozilla/string/obsolete/nsXPIDLString.cpp b/mozilla/string/obsolete/nsXPIDLString.cpp index 9fc4594981c..e43dfdd6a6e 100644 --- a/mozilla/string/obsolete/nsXPIDLString.cpp +++ b/mozilla/string/obsolete/nsXPIDLString.cpp @@ -17,13 +17,14 @@ */ #include "nsDebug.h" +#include "nsIAllocator.h" #include "nsXPIDLString.h" #include "plstr.h" -// XXX change to use nsIAllocator or whatever -#define XPIDL_STRING_ALLOC(__size) new PRUnichar[(__size)] -#define XPIDL_CSTRING_ALLOC(__size) new char[(__size)] -#define XPIDL_FREE(__ptr) delete[] (__ptr) +// If the allocator changes, fix it here. +#define XPIDL_STRING_ALLOC(__len) ((PRUnichar*) nsAllocator::Alloc((__len) * sizeof(PRUnichar))) +#define XPIDL_CSTRING_ALLOC(__len) ((char*) nsAllocator::Alloc((__len) * sizeof(char))) +#define XPIDL_FREE(__ptr) (nsAllocator::Free(__ptr)) //////////////////////////////////////////////////////////////////////// // nsXPIDLString diff --git a/mozilla/xpcom/ds/nsXPIDLString.cpp b/mozilla/xpcom/ds/nsXPIDLString.cpp index 9fc4594981c..e43dfdd6a6e 100644 --- a/mozilla/xpcom/ds/nsXPIDLString.cpp +++ b/mozilla/xpcom/ds/nsXPIDLString.cpp @@ -17,13 +17,14 @@ */ #include "nsDebug.h" +#include "nsIAllocator.h" #include "nsXPIDLString.h" #include "plstr.h" -// XXX change to use nsIAllocator or whatever -#define XPIDL_STRING_ALLOC(__size) new PRUnichar[(__size)] -#define XPIDL_CSTRING_ALLOC(__size) new char[(__size)] -#define XPIDL_FREE(__ptr) delete[] (__ptr) +// If the allocator changes, fix it here. +#define XPIDL_STRING_ALLOC(__len) ((PRUnichar*) nsAllocator::Alloc((__len) * sizeof(PRUnichar))) +#define XPIDL_CSTRING_ALLOC(__len) ((char*) nsAllocator::Alloc((__len) * sizeof(char))) +#define XPIDL_FREE(__ptr) (nsAllocator::Free(__ptr)) //////////////////////////////////////////////////////////////////////// // nsXPIDLString diff --git a/mozilla/xpcom/src/nsXPIDLString.cpp b/mozilla/xpcom/src/nsXPIDLString.cpp index 9fc4594981c..e43dfdd6a6e 100644 --- a/mozilla/xpcom/src/nsXPIDLString.cpp +++ b/mozilla/xpcom/src/nsXPIDLString.cpp @@ -17,13 +17,14 @@ */ #include "nsDebug.h" +#include "nsIAllocator.h" #include "nsXPIDLString.h" #include "plstr.h" -// XXX change to use nsIAllocator or whatever -#define XPIDL_STRING_ALLOC(__size) new PRUnichar[(__size)] -#define XPIDL_CSTRING_ALLOC(__size) new char[(__size)] -#define XPIDL_FREE(__ptr) delete[] (__ptr) +// If the allocator changes, fix it here. +#define XPIDL_STRING_ALLOC(__len) ((PRUnichar*) nsAllocator::Alloc((__len) * sizeof(PRUnichar))) +#define XPIDL_CSTRING_ALLOC(__len) ((char*) nsAllocator::Alloc((__len) * sizeof(char))) +#define XPIDL_FREE(__ptr) (nsAllocator::Free(__ptr)) //////////////////////////////////////////////////////////////////////// // nsXPIDLString diff --git a/mozilla/xpcom/string/obsolete/nsXPIDLString.cpp b/mozilla/xpcom/string/obsolete/nsXPIDLString.cpp index 9fc4594981c..e43dfdd6a6e 100644 --- a/mozilla/xpcom/string/obsolete/nsXPIDLString.cpp +++ b/mozilla/xpcom/string/obsolete/nsXPIDLString.cpp @@ -17,13 +17,14 @@ */ #include "nsDebug.h" +#include "nsIAllocator.h" #include "nsXPIDLString.h" #include "plstr.h" -// XXX change to use nsIAllocator or whatever -#define XPIDL_STRING_ALLOC(__size) new PRUnichar[(__size)] -#define XPIDL_CSTRING_ALLOC(__size) new char[(__size)] -#define XPIDL_FREE(__ptr) delete[] (__ptr) +// If the allocator changes, fix it here. +#define XPIDL_STRING_ALLOC(__len) ((PRUnichar*) nsAllocator::Alloc((__len) * sizeof(PRUnichar))) +#define XPIDL_CSTRING_ALLOC(__len) ((char*) nsAllocator::Alloc((__len) * sizeof(char))) +#define XPIDL_FREE(__ptr) (nsAllocator::Free(__ptr)) //////////////////////////////////////////////////////////////////////// // nsXPIDLString