Index: /trunk/src/libs/xpcom18a4/nsprpub/pr/src/malloc/prmem.c
===================================================================
--- /trunk/src/libs/xpcom18a4/nsprpub/pr/src/malloc/prmem.c	(revision 31252)
+++ /trunk/src/libs/xpcom18a4/nsprpub/pr/src/malloc/prmem.c	(revision 31253)
@@ -41,4 +41,7 @@
 
 #include "primpl.h"
+#ifdef VBOX_USE_MORE_IPRT_IN_NSPR
+# include <iprt/mem.h>
+#endif
 
 #ifdef _PR_ZONE_ALLOCATOR
@@ -54,5 +57,5 @@
 */
 
-#include <string.h>	
+#include <string.h>
 
 union memBlkHdrUn;
@@ -92,10 +95,10 @@
 void
 _PR_DestroyZones(void)
-{   
+{
     int i, j;
 
     if (!use_zone_allocator)
         return;
-    
+
     for (j = 0; j < THREAD_POOLS; j++) {
         for (i = 0; i < MEM_ZONES; i++) {
@@ -109,7 +112,7 @@
             }
         }
-    } 
+    }
     use_zone_allocator = PR_FALSE;
-} 
+}
 
 /*
@@ -184,5 +187,5 @@
         return;
 
-    for (j = 0; j < THREAD_POOLS; j++) { 
+    for (j = 0; j < THREAD_POOLS; j++) {
         for (i = 0; i < MEM_ZONES; i++) {
             MemoryZone *mz = &zones[i][j];
@@ -191,5 +194,5 @@
             if (rv != 0) {
                 goto loser;
-            } 
+            }
             mz->blockSize = 16 << ( 2 * i);
         }
@@ -365,5 +368,5 @@
         PR_ASSERT(mt->s.zone  == mb->s.zone);
         PR_ASSERT(mt->s.blockSize == blockSize);
-	
+
         if (bytes <= blockSize) {
             /* The block is already big enough. */
@@ -373,5 +376,5 @@
         ours = 1;
     }
-    
+
     rv = pr_ZoneMalloc(bytes);
     if (rv) {
@@ -438,5 +441,9 @@
     if (!_pr_initialized) _PR_ImplicitInitialization();
 
+#ifdef VBOX_USE_MORE_IPRT_IN_NSPR
+    return use_zone_allocator ? pr_ZoneMalloc(size) : RTMemAlloc(size);
+#else
     return use_zone_allocator ? pr_ZoneMalloc(size) : malloc(size);
+#endif
 }
 
@@ -446,5 +453,9 @@
 
     return use_zone_allocator ?
+#ifdef VBOX_USE_MORE_IPRT_IN_NSPR
+        pr_ZoneCalloc(nelem, elsize) : RTMemAllocZ(nelem * (size_t)elsize);
+#else
         pr_ZoneCalloc(nelem, elsize) : calloc(nelem, elsize);
+#endif
 }
 
@@ -453,5 +464,9 @@
     if (!_pr_initialized) _PR_ImplicitInitialization();
 
+#ifdef VBOX_USE_MORE_IPRT_IN_NSPR
+    return use_zone_allocator ? pr_ZoneRealloc(ptr, size) : RTMemRealloc(ptr, size);
+#else
     return use_zone_allocator ? pr_ZoneRealloc(ptr, size) : realloc(ptr, size);
+#endif
 }
 
@@ -461,5 +476,9 @@
         pr_ZoneFree(ptr);
     else
+#ifdef VBOX_USE_MORE_IPRT_IN_NSPR
+        RTMemFree(ptr);
+#else
         free(ptr);
+#endif
 }
 
@@ -479,5 +498,9 @@
     return PR_MD_malloc( (size_t) size);
 #else
+# ifdef VBOX_USE_MORE_IPRT_IN_NSPR
+    return RTMemAlloc(size);
+# else
     return malloc(size);
+# endif
 #endif
 }
@@ -487,7 +510,11 @@
 #if defined (WIN16)
     return PR_MD_calloc( (size_t)nelem, (size_t)elsize );
-    
-#else
+
+#else
+# ifdef VBOX_USE_MORE_IPRT_IN_NSPR
+    return RTMemAllocZ(nelem * (size_t)elsize);
+# else
     return calloc(nelem, elsize);
+# endif
 #endif
 }
@@ -498,5 +525,9 @@
     return PR_MD_realloc( ptr, (size_t) size);
 #else
+# ifdef VBOX_USE_MORE_IPRT_IN_NSPR
+    return RTMemRealloc(ptr, size);
+# else
     return realloc(ptr, size);
+# endif
 #endif
 }
@@ -507,5 +538,9 @@
     PR_MD_free( ptr );
 #else
+# ifdef VBOX_USE_MORE_IPRT_IN_NSPR
+    RTMemFree(ptr);
+# else
     free(ptr);
+# endif
 #endif
 }
