VirtualBox

Changeset 101962 in vbox


Ignore:
Timestamp:
Nov 8, 2023 12:01:00 PM (16 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
160059
Message:

libs/xpcom: Convert PR_GetEnv/PR_SetEnv to IPRT RTEnv* API, bugref:10545

Location:
trunk/src/libs/xpcom18a4
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/ipc/ipcd/shared/src/ipcConfig.cpp

    r16561 r101962  
    4747#include "ipcConfig.h"
    4848#include "ipcLog.h"
    49 #include "prenv.h"
    5049#include "plstr.h"
     50
     51#include <iprt/env.h>
    5152
    5253#if defined(XP_OS2) && !defined(XP_OS2_NATIVEIPC)
     
    7576    bufLen -= (sizeof(kDefaultSocketPrefix) - 1);
    7677
    77     logName = PR_GetEnv("VBOX_IPC_SOCKETID");
     78    logName = RTEnvGet("VBOX_IPC_SOCKETID");
    7879#if defined(VBOX) && defined(XP_UNIX)
    7980    if (!logName || !logName[0]) {
     
    8485#endif
    8586    if (!logName || !logName[0]) {
    86         logName = PR_GetEnv("LOGNAME");
     87        logName = RTEnvGet("LOGNAME");
    8788        if (!logName || !logName[0]) {
    88             logName = PR_GetEnv("USER");
     89            logName = RTEnvGet("USER");
    8990            if (!logName || !logName[0]) {
    9091                LOG(("could not determine username from environment\n"));
  • trunk/src/libs/xpcom18a4/ipc/ipcd/shared/src/ipcLog.cpp

    r46593 r101962  
    4848#include "plstr.h"
    4949
    50 #ifdef VBOX
    51 # if defined(__OS2__) && defined(PAGE_SIZE)
    52 #  undef PAGE_SIZE
    53 # endif
    54 # include <iprt/initterm.h> // for RTR3InitDll
    55 #else // !VBOX
    56 PRBool ipcLogEnabled = PR_FALSE;
    57 #endif // !VBOX
     50#include <iprt/initterm.h> // for RTR3InitDll
    5851
    5952char ipcLogPrefix[10] = {0};
    60 
    61 #ifndef VBOX
    62 
    63 //-----------------------------------------------------------------------------
    64 // UNIX
    65 //-----------------------------------------------------------------------------
    66 #if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
    67 
    68 #include <sys/types.h>
    69 #include <unistd.h>
    70 
    71 static inline PRUint32
    72 WritePrefix(char *buf, PRUint32 bufLen)
    73 {
    74     return PR_snprintf(buf, bufLen, "[%u:%p] %s ",
    75                        (unsigned) getpid(),
    76                        PR_GetCurrentThread(),
    77                        ipcLogPrefix);
    78 }
    79 #endif
    80 
    81 //-----------------------------------------------------------------------------
    82 // WIN32
    83 //-----------------------------------------------------------------------------
    84 #ifdef XP_WIN
    85 #include <windows.h>
    86 
    87 static inline PRUint32
    88 WritePrefix(char *buf, PRUint32 bufLen)
    89 {
    90     return PR_snprintf(buf, bufLen, "[%u:%p] %s ",
    91                        GetCurrentProcessId(),
    92                        PR_GetCurrentThread(),
    93                        ipcLogPrefix);
    94 }
    95 #endif
    96 
    97 #endif // !VBOX
    9853
    9954//-----------------------------------------------------------------------------
     
    10459IPC_InitLog(const char *prefix)
    10560{
    106 #ifdef VBOX
    10761    // initialize VBox Runtime
    10862    RTR3InitDll(RTR3INIT_FLAGS_UNOBTRUSIVE);
    10963
    11064    PL_strncpyz(ipcLogPrefix, prefix, sizeof(ipcLogPrefix));
    111 #else
    112     if (PR_GetEnv("IPC_LOG_ENABLE")) {
    113         ipcLogEnabled = PR_TRUE;
    114         PL_strncpyz(ipcLogPrefix, prefix, sizeof(ipcLogPrefix));
    115     }
    116 #endif
    11765}
    11866
     
    12573    char buf[512];
    12674
    127 #ifdef VBOX
    12875    if (ipcLogPrefix[0]) {
    12976        nb = strlen(ipcLogPrefix);
     
    13380        buf[nb++] = ' ';
    13481    }
    135 #else
    136     if (ipcLogPrefix[0])
    137         nb = WritePrefix(buf, sizeof(buf));
    138 #endif
    13982
    14083    PR_vsnprintf(buf + nb, sizeof(buf) - nb, fmt, ap);
    14184    buf[sizeof(buf) - 1] = '\0';
    14285
    143 #ifdef VBOX
    14486    LogFlow(("%s", buf));
    145 #else
    146     fwrite(buf, strlen(buf), 1, stdout);
    147 #endif
    148 
    14987    va_end(ap);
    15088}
  • trunk/src/libs/xpcom18a4/nsprpub/pr/src/io/prfdcach.c

    r1 r101962  
    254254void _PR_InitFdCache(void)
    255255{
    256     /*
    257     ** The fd caching is enabled by default for DEBUG builds,
    258     ** disabled by default for OPT builds. That default can
    259     ** be overridden at runtime using environment variables
    260     ** or a super-wiz-bang API.
    261     */
    262     const char *low = PR_GetEnv("NSPR_FD_CACHE_SIZE_LOW");
    263     const char *high = PR_GetEnv("NSPR_FD_CACHE_SIZE_HIGH");
    264 
    265256    /*
    266257    ** _low is allowed to be zero, _high is not.
     
    275266#endif  /* defined(DEBUG) */
    276267
    277     if (NULL != low) _pr_fd_cache.limit_low = atoi(low);
    278     if (NULL != high) _pr_fd_cache.limit_high = atoi(high);
    279 
    280268    if (_pr_fd_cache.limit_high < _pr_fd_cache.limit_low)
    281269        _pr_fd_cache.limit_high = _pr_fd_cache.limit_low;
  • trunk/src/libs/xpcom18a4/nsprpub/pr/src/io/prlog.c

    r101869 r101962  
    5555#endif
    5656#ifdef VBOX_USE_IPRT_IN_NSPR
     57# include <iprt/env.h>
    5758# include <iprt/string.h>
    5859#endif
     
    146147    _pr_logLock = PR_NewLock();
    147148
    148     ev = PR_GetEnv("NSPR_LOG_MODULES");
     149    ev = RTEnvGet("NSPR_LOG_MODULES");
    149150    if (ev && ev[0]) {
    150151        char module[64];  /* Security-Critical: If you change this
     
    193194        PR_SetLogBuffering(isSync ? bufSize : 0);
    194195
    195         ev = PR_GetEnv("NSPR_LOG_FILE");
     196        ev = RTEnvGet("NSPR_LOG_FILE");
    196197        if (ev && ev[0]) {
    197198            if (!PR_SetLogFile(ev)) {
     
    255256    char *ev;
    256257
    257     ev = PR_GetEnv("NSPR_LOG_MODULES");
     258    ev = RTEnvGet("NSPR_LOG_MODULES");
    258259    if (ev && ev[0]) {
    259260        char module[64];  /* Security-Critical: If you change this
  • trunk/src/libs/xpcom18a4/nsprpub/pr/src/misc/prinit.c

    r101961 r101962  
    295295    PRIntn fileType;
    296296
    297     envVar = PR_GetEnv("NSPR_INHERIT_FDS");
     297    envVar = RTEnvGet("NSPR_INHERIT_FDS");
    298298    if (NULL == envVar || '\0' == envVar[0]) {
    299299        PR_SetError(PR_UNKNOWN_ERROR, 0);
  • trunk/src/libs/xpcom18a4/xpcom/ds/nsAtomTable.cpp

    r1 r101962  
    4343#include "nsCRT.h"
    4444#include "pldhash.h"
    45 #include "prenv.h"
    4645#include "nsVoidArray.h"
    4746
     
    264263{
    265264  if (gAtomTable.ops) {
    266 #ifdef DEBUG
    267     if (PR_GetEnv("MOZ_DUMP_ATOM_LEAKS")) {
    268       PRUint32 leaked = 0;
    269       printf("*** %d atoms still exist (including permanent):\n",
    270              gAtomTable.entryCount);
    271       PL_DHashTableEnumerate(&gAtomTable, DumpAtomLeaks, &leaked);
    272       printf("*** %u non-permanent atoms leaked\n", leaked);
    273     }
    274 #endif
    275265    PL_DHashTableFinish(&gAtomTable);
    276266    gAtomTable.entryCount = 0;
  • trunk/src/libs/xpcom18a4/xpcom/io/SpecialSystemDirectory.cpp

    r101866 r101962  
    4949#include <stdlib.h>
    5050#include <sys/param.h>
    51 #include "prenv.h"
    5251# if defined(XP_MACOSX) && defined(VBOX_WITH_NEWER_OSX_SDK)
    5352# include <Folders.h>
     
    5554
    5655#endif
     56
     57#include <iprt/env.h>
    5758
    5859NS_COM void StartupSpecialSystemDirectory()
     
    8586            static const char *tPath = nsnull;
    8687            if (!tPath) {
    87                 tPath = PR_GetEnv("TMPDIR");
     88                tPath = RTEnvGet("TMPDIR");
    8889                if (!tPath || !*tPath) {
    89                     tPath = PR_GetEnv("TMP");
     90                    tPath = RTEnvGet("TMP");
    9091                    if (!tPath || !*tPath) {
    91                         tPath = PR_GetEnv("TEMP");
     92                        tPath = RTEnvGet("TEMP");
    9293                        if (!tPath || !*tPath) {
    9394                            tPath = "/tmp/";
     
    115116
    116117        case Unix_HomeDirectory:
    117             return NS_NewNativeLocalFile(nsDependentCString(PR_GetEnv("HOME")),
     118            return NS_NewNativeLocalFile(nsDependentCString(RTEnvGet("HOME")),
    118119                                             PR_TRUE,
    119120                                             aFile);
  • trunk/src/libs/xpcom18a4/xpcom/io/nsAppFileLocationProvider.cpp

    r87254 r101962  
    4646#include "nsXPIDLString.h"
    4747#include "nsISimpleEnumerator.h"
    48 #include "prenv.h"
    4948#include "nsCRT.h"
    5049
     
    7271#endif
    7372
     73#include <iprt/env.h>
    7474
    7575// WARNING: These hard coded names need to go away. They need to
     
    251251        NS_ERROR("Don't use nsAppFileLocationProvider::GetFile(NS_ENV_PLUGINS_DIR, ...). "
    252252                 "Use nsAppFileLocationProvider::GetFiles(...).");
    253         const char *pathVar = PR_GetEnv("VBOX_XPCOM_PLUGIN_PATH");
     253        const char *pathVar = RTEnvGet("VBOX_XPCOM_PLUGIN_PATH");
    254254        if (pathVar)
    255255            rv = NS_NewNativeLocalFile(nsDependentCString(pathVar), PR_TRUE, getter_AddRefs(localFile));
     
    380380    if (NS_FAILED(rv)) return rv;
    381381#elif defined(XP_UNIX)
    382     rv = NS_NewNativeLocalFile(nsDependentCString(PR_GetEnv("HOME")), PR_TRUE, getter_AddRefs(localDir));
     382    rv = NS_NewNativeLocalFile(nsDependentCString(RTEnvGet("HOME")), PR_TRUE, getter_AddRefs(localDir));
    383383    if (NS_FAILED(rv)) return rv;
    384384#elif defined(XP_BEOS)
     
    596596#else
    597597        static const char* keys[] = { nsnull, NS_APP_PLUGINS_DIR, nsnull };
    598         if (!keys[0] && !(keys[0] = PR_GetEnv("VBOX_XPCOM_PLUGIN_PATH"))) {
     598        if (!keys[0] && !(keys[0] = RTEnvGet("VBOX_XPCOM_PLUGIN_PATH"))) {
    599599            static const char nullstr = 0;
    600600            keys[0] = &nullstr;
  • trunk/src/libs/xpcom18a4/xpcom/io/nsDirectoryService.cpp

    r101866 r101962  
    4949#include <sys/param.h>
    5050#include <dlfcn.h>
    51 #include "prenv.h"
    5251#ifdef XP_MACOSX
    5352#include <CoreServices/CoreServices.h>
     
    6362#endif
    6463#endif
     64
     65#include <iprt/env.h>
    6566
    6667#include "SpecialSystemDirectory.h"
     
    173174    // we only do this if it is not already set.
    174175#ifdef MOZ_DEFAULT_VBOX_XPCOM_HOME
    175     if (PR_GetEnv("VBOX_XPCOM_HOME") == nsnull)
    176         PR_SetEnv("VBOX_XPCOM_HOME=" MOZ_DEFAULT_VBOX_XPCOM_HOME);
     176    if (RTEnvGet("VBOX_XPCOM_HOME") == nsnull)
     177        RTEnvPut("VBOX_XPCOM_HOME=" MOZ_DEFAULT_VBOX_XPCOM_HOME);
    177178#endif
    178179
    179     char *moz5 = PR_GetEnv("VBOX_XPCOM_HOME");
     180    const char *moz5 = RTEnvGet("VBOX_XPCOM_HOME");
    180181
    181182    if (moz5)
  • trunk/src/libs/xpcom18a4/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp

    r101922 r101962  
    4444#include "nsString.h"
    4545
     46#include <iprt/env.h>
     47
    4648#define NS_ZIPLOADER_CONTRACTID NS_XPTLOADER_CONTRACTID_PREFIX "zip"
    4749
     
    135137    AssertRC(vrc); RT_NOREF(vrc);
    136138
    137     const char* statsFilename = PR_GetEnv("MOZILLA_XPTI_STATS");
     139    const char* statsFilename = RTEnvGet("MOZILLA_XPTI_STATS");
    138140    if(statsFilename)
    139141    {
     
    151153    }
    152154
    153     const char* autoRegFilename = PR_GetEnv("MOZILLA_XPTI_REGLOG");
     155    const char* autoRegFilename = RTEnvGet("MOZILLA_XPTI_REGLOG");
    154156    if(autoRegFilename)
    155157    {
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette