Changeset 20364 in vbox for trunk/src/VBox/Runtime/generic
- Timestamp:
- Jun 8, 2009 12:17:43 AM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 48287
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/generic/env-generic.cpp
r8245 r20364 49 49 #endif 50 50 #if defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD) || defined(RT_OS_OPENBSD) 51 __BEGIN_DECLS51 RT_BEGIN_DECLS 52 52 extern char **environ; 53 __END_DECLS53 RT_END_DECLS 54 54 #endif 55 55 … … 73 73 /** Magic value . */ 74 74 uint32_t u32Magic; 75 /** Number of variables in the array. 75 /** Number of variables in the array. 76 76 * This does not include the terminating NULL entry. */ 77 77 size_t cVars; 78 /** Capacity (allocated size) of the array. 79 * This includes space for the terminating NULL element (for compatibility 78 /** Capacity (allocated size) of the array. 79 * This includes space for the terminating NULL element (for compatibility 80 80 * with the C library), so that c <= cCapacity - 1. */ 81 81 size_t cAllocated; 82 82 /** Array of environment variables. */ 83 83 char **papszEnv; 84 /** Array of environment variables in the process CP. 84 /** Array of environment variables in the process CP. 85 85 * This get (re-)constructed when RTEnvGetExecEnvP method is called. */ 86 86 char **papszEnvOtherCP; … … 92 92 93 93 /** 94 * Internal worker that resolves the pointer to the default 94 * Internal worker that resolves the pointer to the default 95 95 * process environment. (environ) 96 * 96 * 97 97 * @returns Pointer to the default environment. 98 98 * This may be NULL. … … 102 102 #ifdef RT_OS_DARWIN 103 103 return *(_NSGetEnviron()); 104 #elif defined(RT_OS_L4) 104 #elif defined(RT_OS_L4) 105 105 /* So far, our L4 libraries do not include environment support. */ 106 106 return NULL; 107 107 #else 108 108 return environ; 109 #endif 109 #endif 110 110 } 111 111 … … 113 113 /** 114 114 * Internal worker that creates an environment handle with a specified capacity. 115 * 115 * 116 116 * @returns IPRT status code. 117 117 * @param ppIntEnv Where to store the result. … … 141 141 142 142 RTMemFree(pIntEnv); 143 } 143 } 144 144 145 145 return VERR_NO_MEMORY; … … 156 156 RTDECL(int) RTEnvDestroy(RTENV Env) 157 157 { 158 /* 158 /* 159 159 * Ignore NIL_RTENV and validate input. 160 160 */ … … 167 167 AssertReturn(pIntEnv->u32Magic == RTENV_MAGIC, VERR_INVALID_HANDLE); 168 168 169 /* 169 /* 170 170 * Do the cleanup. 171 171 */ … … 192 192 /*RTCritSectDelete(&pIntEnv->CritSect) */ 193 193 RTMemFree(pIntEnv); 194 194 195 195 return VINF_SUCCESS; 196 196 } … … 285 285 else 286 286 { 287 /* 287 /* 288 288 * Make a copy of the variable name so we can terminate it 289 289 * properly and then pass the request on to RTEnvSetEx. … … 312 312 if (Env == RTENV_DEFAULT) 313 313 { 314 /* 314 /* 315 315 * Since RTEnvPut isn't UTF-8 clean and actually expects the strings 316 * to be in the current code page (codeset), we'll do the necessary 316 * to be in the current code page (codeset), we'll do the necessary 317 317 * conversions here. 318 318 */ … … 362 362 if (iVar < pIntEnv->cVars) 363 363 { 364 /* 364 /* 365 365 * Replace the current entry. Simple. 366 366 */ … … 371 371 { 372 372 /* 373 * Adding a new variable. Resize the array if required 373 * Adding a new variable. Resize the array if required 374 374 * and then insert the new value at the end. 375 375 */ … … 395 395 } 396 396 } 397 397 398 398 RTENV_UNLOCK(pIntEnv); 399 399 … … 416 416 if (Env == RTENV_DEFAULT) 417 417 { 418 /* 418 /* 419 419 * Since RTEnvUnset isn't UTF-8 clean and actually expects the strings 420 * to be in the current code page (codeset), we'll do the necessary 420 * to be in the current code page (codeset), we'll do the necessary 421 421 * conversions here. 422 422 */ … … 459 459 } 460 460 return rc; 461 461 462 462 } 463 463 … … 475 475 if (Env == RTENV_DEFAULT) 476 476 { 477 /* 477 /* 478 478 * Since RTEnvGet isn't UTF-8 clean and actually expects the strings 479 * to be in the current code page (codeset), we'll do the necessary 479 * to be in the current code page (codeset), we'll do the necessary 480 480 * conversions here. 481 481 */ … … 545 545 } 546 546 return rc; 547 547 548 548 } 549 549 … … 556 556 if (Env == RTENV_DEFAULT) 557 557 { 558 /* 558 /* 559 559 * Since RTEnvExist isn't UTF-8 clean and actually expects the strings 560 * to be in the current code page (codeset), we'll do the necessary 560 * to be in the current code page (codeset), we'll do the necessary 561 561 * conversions here. 562 562 */ … … 615 615 RTENV_LOCK(pIntEnv); 616 616 617 /* 618 * Free any old envp. 617 /* 618 * Free any old envp. 619 619 */ 620 620 if (pIntEnv->papszEnvOtherCP)
Note:
See TracChangeset
for help on using the changeset viewer.