Bug 1253160 (part 1) - Remove port_allocFailures, which isn't used usefully. r=mt. draft
authorNicholas Nethercote <nnethercote@mozilla.com>
Fri, 04 Mar 2016 11:21:58 +1100
changeset 336641 47413713edeca7d1576a0b77897e7aeff932f22c
parent 335975 9e40f176301408d83cc041537b6c5752965e3481
child 336642 efbf5dac31c4160b9cda1d78a7355b01d62c362a
push id12158
push usernnethercote@mozilla.com
push dateFri, 04 Mar 2016 00:40:17 +0000
reviewersmt
bugs1253160
milestone47.0a1
Bug 1253160 (part 1) - Remove port_allocFailures, which isn't used usefully. r=mt. MozReview-Commit-ID: 5dYbeE9szDk
security/nss/lib/util/secport.c
--- a/security/nss/lib/util/secport.c
+++ b/security/nss/lib/util/secport.c
@@ -53,19 +53,16 @@ typedef struct PORTArenaPool_str {
   PRLock *    lock;
 #ifdef THREADMARK
   PRThread *marking_thread;
   threadmark_mark *first_mark;
 #endif
 } PORTArenaPool;
 
 
-/* count of allocation failures. */
-unsigned long port_allocFailures;
-
 /* locations for registering Unicode conversion functions.  
  * XXX is this the appropriate location?  or should they be
  *     moved to client/server specific locations?
  */
 PORTCharConversionFunc ucs4Utf8ConvertFunc;
 PORTCharConversionFunc ucs2Utf8ConvertFunc;
 PORTCharConversionWSwapFunc  ucs2AsciiConvertFunc;
 
@@ -81,48 +78,45 @@ PORT_Alloc(size_t bytes)
 {
     void *rv = NULL;
 
     if (bytes <= MAX_SIZE) {
 	/* Always allocate a non-zero amount of bytes */
 	rv = PR_Malloc(bytes ? bytes : 1);
     }
     if (!rv) {
-	++port_allocFailures;
 	PORT_SetError(SEC_ERROR_NO_MEMORY);
     }
     return rv;
 }
 
 void *
 PORT_Realloc(void *oldptr, size_t bytes)
 {
     void *rv = NULL;
 
     if (bytes <= MAX_SIZE) {
 	rv = PR_Realloc(oldptr, bytes);
     }
     if (!rv) {
-	++port_allocFailures;
 	PORT_SetError(SEC_ERROR_NO_MEMORY);
     }
     return rv;
 }
 
 void *
 PORT_ZAlloc(size_t bytes)
 {
     void *rv = NULL;
 
     if (bytes <= MAX_SIZE) {
 	/* Always allocate a non-zero amount of bytes */
 	rv = PR_Calloc(1, bytes ? bytes : 1);
     }
     if (!rv) {
-	++port_allocFailures;
 	PORT_SetError(SEC_ERROR_NO_MEMORY);
     }
     return rv;
 }
 
 void
 PORT_Free(void *ptr)
 {
@@ -228,17 +222,16 @@ PORT_NewArena(unsigned long chunksize)
     }
     pool = PORT_ZNew(PORTArenaPool);
     if (!pool) {
 	return NULL;
     }
     pool->magic = ARENAPOOL_MAGIC;
     pool->lock = PZ_NewLock(nssILockArena);
     if (!pool->lock) {
-	++port_allocFailures;
 	PORT_Free(pool);
 	return NULL;
     }
     PL_InitArenaPool(&pool->arena, "security", chunksize, sizeof(double));
     return(&pool->arena);
 }
 
 void *
@@ -271,17 +264,16 @@ PORT_ArenaAlloc(PLArenaPool *arena, size
 #endif /* THREADMARK */
 	PL_ARENA_ALLOCATE(p, arena, size);
 	PZ_Unlock(pool->lock);
     } else {
 	PL_ARENA_ALLOCATE(p, arena, size);
     }
 
     if (!p) {
-	++port_allocFailures;
 	PORT_SetError(SEC_ERROR_NO_MEMORY);
     }
 
     return(p);
 }
 
 void *
 PORT_ArenaZAlloc(PLArenaPool *arena, size_t size)