Bug 1253160 (part 1) - Remove port_allocFailures, which isn't used usefully. r=mt.
MozReview-Commit-ID: 5dYbeE9szDk
--- 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)