diff --git a/base/src/nsCRT.h b/base/src/nsCRT.h index 29e8cd0b7de8..4ad107b22b0b 100644 --- a/base/src/nsCRT.h +++ b/base/src/nsCRT.h @@ -129,6 +129,10 @@ public: return PL_strdup(str); } + static void free(char* str) { + PL_strfree(str); + } + /** How to use this fancy (thread-safe) version of strtok: @@ -179,6 +183,10 @@ public: // free the memory static PRUnichar* strdup(const PRUnichar* str); + static void free(PRUnichar* str) { + delete[] str; + } + /// Compute a hashcode for a ucs2 string static PRUint32 HashValue(const PRUnichar* s1); diff --git a/xpcom/ds/nsCRT.h b/xpcom/ds/nsCRT.h index 29e8cd0b7de8..4ad107b22b0b 100644 --- a/xpcom/ds/nsCRT.h +++ b/xpcom/ds/nsCRT.h @@ -129,6 +129,10 @@ public: return PL_strdup(str); } + static void free(char* str) { + PL_strfree(str); + } + /** How to use this fancy (thread-safe) version of strtok: @@ -179,6 +183,10 @@ public: // free the memory static PRUnichar* strdup(const PRUnichar* str); + static void free(PRUnichar* str) { + delete[] str; + } + /// Compute a hashcode for a ucs2 string static PRUint32 HashValue(const PRUnichar* s1);