From 8d8effeeb2e931d17a8272216ad0c64d827bbeb5 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 10 Apr 2007 21:10:42 +0000 Subject: [PATCH] starting to slim down the nspr build in prep to merge with the libjs build. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4910 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/js/nsprpub/pr/src/io/prfdcach.c | 8 +- libs/js/nsprpub/pr/src/io/prlog.c | 10 +- libs/js/nsprpub/pr/src/misc/prinit.c | 126 +-------- libs/js/nsprpub/pr/src/threads/prcthr.c | 8 - libs/win32/js/js.vcproj | 340 ++++++++++++++---------- 5 files changed, 217 insertions(+), 275 deletions(-) diff --git a/libs/js/nsprpub/pr/src/io/prfdcach.c b/libs/js/nsprpub/pr/src/io/prfdcach.c index aea19dff47..285c8b852a 100644 --- a/libs/js/nsprpub/pr/src/io/prfdcach.c +++ b/libs/js/nsprpub/pr/src/io/prfdcach.c @@ -259,8 +259,8 @@ void _PR_InitFdCache(void) ** be overridden at runtime using environment variables ** or a super-wiz-bang API. */ - const char *low = PR_GetEnv("NSPR_FD_CACHE_SIZE_LOW"); - const char *high = PR_GetEnv("NSPR_FD_CACHE_SIZE_HIGH"); + //const char *low = PR_GetEnv("NSPR_FD_CACHE_SIZE_LOW"); + //const char *high = PR_GetEnv("NSPR_FD_CACHE_SIZE_HIGH"); /* ** _low is allowed to be zero, _high is not. @@ -274,8 +274,8 @@ void _PR_InitFdCache(void) _pr_fd_cache.limit_high = 0; #endif /* defined(DEBUG) */ - if (NULL != low) _pr_fd_cache.limit_low = atoi(low); - if (NULL != high) _pr_fd_cache.limit_high = atoi(high); + //if (NULL != low) _pr_fd_cache.limit_low = atoi(low); + //if (NULL != high) _pr_fd_cache.limit_high = atoi(high); if (_pr_fd_cache.limit_high < _pr_fd_cache.limit_low) _pr_fd_cache.limit_high = _pr_fd_cache.limit_low; diff --git a/libs/js/nsprpub/pr/src/io/prlog.c b/libs/js/nsprpub/pr/src/io/prlog.c index ab348d4fba..f8178e2e63 100644 --- a/libs/js/nsprpub/pr/src/io/prlog.c +++ b/libs/js/nsprpub/pr/src/io/prlog.c @@ -204,11 +204,11 @@ PRIntn strcasecmp(const char *a, const char *b) void _PR_InitLog(void) { - char *ev; + char *ev = NULL; _pr_logLock = PR_NewLock(); - ev = PR_GetEnv("NSPR_LOG_MODULES"); +// ev = PR_GetEnv("NSPR_LOG_MODULES"); if (ev && ev[0]) { char module[64]; /* Security-Critical: If you change this * size, you must also change the sscanf @@ -255,7 +255,7 @@ void _PR_InitLog(void) } PR_SetLogBuffering(isSync ? bufSize : 0); - ev = PR_GetEnv("NSPR_LOG_FILE"); + //ev = PR_GetEnv("NSPR_LOG_FILE"); if (ev && ev[0]) { if (!PR_SetLogFile(ev)) { #ifdef XP_PC @@ -316,9 +316,9 @@ void _PR_LogCleanup(void) static void _PR_SetLogModuleLevel( PRLogModuleInfo *lm ) { - char *ev; + char *ev = NULL; - ev = PR_GetEnv("NSPR_LOG_MODULES"); + //ev = PR_GetEnv("NSPR_LOG_MODULES"); if (ev && ev[0]) { char module[64]; /* Security-Critical: If you change this * size, you must also change the sscanf diff --git a/libs/js/nsprpub/pr/src/misc/prinit.c b/libs/js/nsprpub/pr/src/misc/prinit.c index 3fb92f1858..5c2353b191 100644 --- a/libs/js/nsprpub/pr/src/misc/prinit.c +++ b/libs/js/nsprpub/pr/src/misc/prinit.c @@ -202,7 +202,7 @@ static void _PR_InitStuff(void) _PR_InitSegs(); _PR_InitStacks(); _PR_InitTPD(); - _PR_InitEnv(); + //_PR_InitEnv(); _PR_InitLayerCache(); _PR_InitClock(); @@ -234,20 +234,20 @@ static void _PR_InitStuff(void) _PR_InitMem(); #endif - _PR_InitCMon(); + //_PR_InitCMon(); _PR_InitIO(); - _PR_InitNet(); + //_PR_InitNet(); _PR_InitLog(); - _PR_InitLinker(); + //_PR_InitLinker(); _PR_InitCallOnce(); - _PR_InitDtoa(); + //_PR_InitDtoa(); _PR_InitMW(); - _PR_InitRWLocks(); + //_PR_InitRWLocks(); - nspr_InitializePRErrorTable(); + //nspr_InitializePRErrorTable(); #if !defined(_PR_INET6) || defined(_PR_INET6_PROBE) - _pr_init_ipv6(); + //_pr_init_ipv6(); #endif _PR_MD_FINAL_INIT(); @@ -420,9 +420,9 @@ PR_IMPLEMENT(PRStatus) PR_Cleanup() #endif _PR_CleanupMW(); - _PR_CleanupDtoa(); + //_PR_CleanupDtoa(); _PR_CleanupCallOnce(); - _PR_ShutdownLinker(); + //_PR_ShutdownLinker(); /* Release the primordial thread's private data, etc. */ _PR_CleanupThread(me); @@ -452,7 +452,7 @@ PR_IMPLEMENT(PRStatus) PR_Cleanup() * Ideally, for each _PR_InitXXX(), there should be a corresponding * _PR_XXXCleanup() that we can call here. */ - _PR_CleanupNet(); + //_PR_CleanupNet(); _PR_CleanupIO(); #ifdef WINNT _PR_CleanupCPUs(); @@ -461,7 +461,7 @@ PR_IMPLEMENT(PRStatus) PR_Cleanup() PR_DestroyLock(_pr_sleeplock); _pr_sleeplock = NULL; _PR_CleanupLayerCache(); - _PR_CleanupEnv(); + //_PR_CleanupEnv(); _PR_CleanupStacks(); _PR_CleanupBeforeExit(); _pr_initialized = PR_FALSE; @@ -543,25 +543,6 @@ PR_ProcessAttrSetStdioRedirect( } } -/* - * OBSOLETE - */ -PR_IMPLEMENT(void) -PR_SetStdioRedirect( - PRProcessAttr *attr, - PRSpecialFD stdioFd, - PRFileDesc *redirectFd) -{ -#if defined(DEBUG) - static PRBool warn = PR_TRUE; - if (warn) { - warn = _PR_Obsolete("PR_SetStdioRedirect()", - "PR_ProcessAttrSetStdioRedirect()"); - } -#endif - PR_ProcessAttrSetStdioRedirect(attr, stdioFd, redirectFd); -} - PR_IMPLEMENT(PRStatus) PR_ProcessAttrSetCurrentDirectory( PRProcessAttr *attr, @@ -659,75 +640,6 @@ PR_ProcessAttrSetInheritableFD( return PR_SUCCESS; } -PR_IMPLEMENT(PRFileDesc *) PR_GetInheritedFD( - const char *name) -{ - PRFileDesc *fd; - const char *envVar; - const char *ptr; - int len = strlen(name); - PROsfd osfd; - int nColons; - PRIntn fileType; - - envVar = PR_GetEnv("NSPR_INHERIT_FDS"); - if (NULL == envVar || '\0' == envVar[0]) { - PR_SetError(PR_UNKNOWN_ERROR, 0); - return NULL; - } - - ptr = envVar; - while (1) { - if ((ptr[len] == ':') && (strncmp(ptr, name, len) == 0)) { - ptr += len + 1; - PR_sscanf(ptr, "%d:0x%" PR_SCNxOSFD, &fileType, &osfd); - switch ((PRDescType)fileType) { - case PR_DESC_FILE: - fd = PR_ImportFile(osfd); - break; - case PR_DESC_PIPE: - fd = PR_ImportPipe(osfd); - break; - case PR_DESC_SOCKET_TCP: - fd = PR_ImportTCPSocket(osfd); - break; - case PR_DESC_SOCKET_UDP: - fd = PR_ImportUDPSocket(osfd); - break; - default: - PR_ASSERT(0); - PR_SetError(PR_UNKNOWN_ERROR, 0); - fd = NULL; - break; - } - if (fd) { - /* - * An inherited FD is inheritable by default. - * The child process needs to call PR_SetFDInheritable - * to make it non-inheritable if so desired. - */ - fd->secret->inheritable = _PR_TRI_TRUE; - } - return fd; - } - /* Skip three colons */ - nColons = 0; - while (*ptr) { - if (*ptr == ':') { - if (++nColons == 3) { - break; - } - } - ptr++; - } - if (*ptr == '\0') { - PR_SetError(PR_UNKNOWN_ERROR, 0); - return NULL; - } - ptr++; - } -} - PR_IMPLEMENT(PRProcess*) PR_CreateProcess( const char *path, char *const *argv, @@ -851,20 +763,6 @@ PR_IMPLEMENT(PRStatus) PR_CallOnceWithArg( return once->status; } -PRBool _PR_Obsolete(const char *obsolete, const char *preferred) -{ -#if defined(DEBUG) -#ifndef XP_MAC - PR_fprintf( - PR_STDERR, "'%s' is obsolete. Use '%s' instead.\n", - obsolete, (NULL == preferred) ? "something else" : preferred); -#else -#pragma unused (obsolete, preferred) -#endif -#endif - return PR_FALSE; -} /* _PR_Obsolete */ - /* prinit.c */ diff --git a/libs/js/nsprpub/pr/src/threads/prcthr.c b/libs/js/nsprpub/pr/src/threads/prcthr.c index 1e2f469c3a..0b713cac4b 100644 --- a/libs/js/nsprpub/pr/src/threads/prcthr.c +++ b/libs/js/nsprpub/pr/src/threads/prcthr.c @@ -73,14 +73,6 @@ void _PR_CleanupThread(PRThread *thread) thread->environment = NULL; } -PR_IMPLEMENT(PRStatus) PR_Yield() -{ - static PRBool warning = PR_TRUE; - if (warning) warning = _PR_Obsolete( - "PR_Yield()", "PR_Sleep(PR_INTERVAL_NO_WAIT)"); - return (PR_Sleep(PR_INTERVAL_NO_WAIT)); -} - /* ** Make the current thread sleep until "timeout" ticks amount of time ** has expired. If "timeout" is PR_INTERVAL_NO_WAIT then the call is diff --git a/libs/win32/js/js.vcproj b/libs/win32/js/js.vcproj index d3410d073a..7104fc3735 100644 --- a/libs/win32/js/js.vcproj +++ b/libs/win32/js/js.vcproj @@ -692,85 +692,108 @@ - - + + + + + + + + + - - + + + - - + + + - - - - + + + + + + - - - - - - - - + + + - - + + + + + + + + + + + + - - - - - - + + + - - + + + - - - - - - - - + + + + + + - - + + + - - + + + - - + + + - - - - - - + + + - - - - - - - - - - - - - - + + + + + + - - - - + + + + + + + + + + + + - - + + + - - - - + + +