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 336774 4e4baf73388dae7b529993e738ea7410dd43cf94
parent 336773 39482a4423f12087db7046d05f626fae2b7e2ebd
child 336775 921a06d72fd5001034ac2789da6b0f6b1b239a09
child 336778 9c5d33ffc96b7ba78f372b303f524cac30470c28
push id12175
push usernnethercote@mozilla.com
push dateFri, 04 Mar 2016 03:57:22 +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)