| OLD | NEW |
| (Empty) |
| 1 Index: mozilla/security/nss/lib/util/secport.c | |
| 2 =================================================================== | |
| 3 RCS file: /cvsroot/mozilla/security/nss/lib/util/secport.c,v | |
| 4 retrieving revision 1.26 | |
| 5 diff -u -p -u -8 -r1.26 secport.c | |
| 6 --- mozilla/security/nss/lib/util/secport.c 24 Dec 2009 03:37:46 -0000
1.26 | |
| 7 +++ mozilla/security/nss/lib/util/secport.c 21 Jan 2010 22:47:00 -0000 | |
| 8 @@ -47,17 +47,16 @@ | |
| 9 #include "seccomon.h" | |
| 10 #include "prmem.h" | |
| 11 #include "prerror.h" | |
| 12 #include "plarena.h" | |
| 13 #include "secerr.h" | |
| 14 #include "prmon.h" | |
| 15 #include "nssilock.h" | |
| 16 #include "secport.h" | |
| 17 -#include "prvrsion.h" | |
| 18 #include "prenv.h" | |
| 19 | |
| 20 #ifdef DEBUG | |
| 21 #define THREADMARK | |
| 22 #endif /* DEBUG */ | |
| 23 | |
| 24 #ifdef THREADMARK | |
| 25 #include "prthread.h" | |
| 26 @@ -324,42 +323,31 @@ PORT_ArenaZAlloc(PLArenaPool *arena, siz | |
| 27 * If zero is true, zeroize the arena memory before freeing it. | |
| 28 */ | |
| 29 void | |
| 30 PORT_FreeArena(PLArenaPool *arena, PRBool zero) | |
| 31 { | |
| 32 PORTArenaPool *pool = (PORTArenaPool *)arena; | |
| 33 PRLock * lock = (PRLock *)0; | |
| 34 size_t len = sizeof *arena; | |
| 35 - extern const PRVersionDescription * libVersionPoint(void); | |
| 36 - static const PRVersionDescription * pvd; | |
| 37 + static PRBool checkedEnv = PR_FALSE; | |
| 38 static PRBool doFreeArenaPool = PR_FALSE; | |
| 39 | |
| 40 if (!pool) | |
| 41 return; | |
| 42 if (ARENAPOOL_MAGIC == pool->magic ) { | |
| 43 len = sizeof *pool; | |
| 44 lock = pool->lock; | |
| 45 PZ_Lock(lock); | |
| 46 } | |
| 47 - if (!pvd) { | |
| 48 - /* Each of NSPR's DLLs has a function libVersionPoint(). | |
| 49 - ** We could do a lot of extra work to be sure we're calling the | |
| 50 - ** one in the DLL that holds PR_FreeArenaPool, but instead we | |
| 51 - ** rely on the fact that ALL NSPR DLLs in the same directory | |
| 52 - ** must be from the same release, and we call which ever one we get. | |
| 53 - */ | |
| 54 + if (!checkedEnv) { | |
| 55 /* no need for thread protection here */ | |
| 56 - pvd = libVersionPoint(); | |
| 57 - if ((pvd->vMajor > 4) || | |
| 58 - (pvd->vMajor == 4 && pvd->vMinor > 1) || | |
| 59 - (pvd->vMajor == 4 && pvd->vMinor == 1 && pvd->vPatch >= 1)) { | |
| 60 - const char *ev = PR_GetEnv("NSS_DISABLE_ARENA_FREE_LIST"); | |
| 61 - if (!ev) doFreeArenaPool = PR_TRUE; | |
| 62 - } | |
| 63 + const char *ev = PR_GetEnv("NSS_DISABLE_ARENA_FREE_LIST"); | |
| 64 + if (!ev) doFreeArenaPool = PR_TRUE; | |
| 65 + checkedEnv = PR_TRUE; | |
| 66 } | |
| 67 if (zero) { | |
| 68 PLArena *a; | |
| 69 for (a = arena->first.next; a; a = a->next) { | |
| 70 PR_ASSERT(a->base <= a->avail && a->avail <= a->limit); | |
| 71 memset((void *)a->base, 0, a->avail - a->base); | |
| 72 } | |
| 73 } | |
| OLD | NEW |