зеркало из https://github.com/mozilla/pjs.git
Bugzilla bug 97485: added support for the magic "nspr_use_zone_allocator"
global variable.
This commit is contained in:
Родитель
36942213c5
Коммит
ba58cfaf62
|
@ -105,13 +105,62 @@ _PR_DestroyZones(void)
|
||||||
use_zone_allocator = PR_FALSE;
|
use_zone_allocator = PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** pr_FindSymbolInProg
|
||||||
|
**
|
||||||
|
** Find the specified data symbol in the program and return
|
||||||
|
** its address.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef USE_DLFCN
|
||||||
|
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
|
static void *
|
||||||
|
pr_FindSymbolInProg(const char *name)
|
||||||
|
{
|
||||||
|
void *h;
|
||||||
|
void *sym;
|
||||||
|
|
||||||
|
h = dlopen(0, RTLD_LAZY);
|
||||||
|
if (h == NULL)
|
||||||
|
return NULL;
|
||||||
|
sym = dlsym(h, name);
|
||||||
|
(void)dlclose(h);
|
||||||
|
return sym;
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(USE_HPSHL)
|
||||||
|
|
||||||
|
#include <dl.h>
|
||||||
|
|
||||||
|
static void *
|
||||||
|
pr_FindSymbolInProg(const char *name)
|
||||||
|
{
|
||||||
|
shl_t h = NULL;
|
||||||
|
void *sym;
|
||||||
|
|
||||||
|
if (shl_findsym(&h, name, TYPE_DATA, &sym) == -1)
|
||||||
|
return NULL;
|
||||||
|
return sym;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#error "The zone allocator is not supported on this platform"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
_PR_InitZones(void)
|
_PR_InitZones(void)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
char *envp;
|
char *envp;
|
||||||
|
PRBool *sym;
|
||||||
|
|
||||||
if ((envp = getenv("NSPR_USE_ZONE_ALLOCATOR")) != NULL) {
|
if ((sym = pr_FindSymbolInProg("nspr_use_zone_allocator")) != NULL) {
|
||||||
|
use_zone_allocator = *sym;
|
||||||
|
} else if ((envp = getenv("NSPR_USE_ZONE_ALLOCATOR")) != NULL) {
|
||||||
use_zone_allocator = (atoi(envp) == 1);
|
use_zone_allocator = (atoi(envp) == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче