diff options
author | max99x <max99x@gmail.com> | 2011-08-05 14:11:38 +0300 |
---|---|---|
committer | max99x <max99x@gmail.com> | 2011-08-05 16:31:31 +0300 |
commit | 979246c3556fbaf41fcd74b43f1fdab3a8dcd196 (patch) | |
tree | d39551c45d1ffec58354e2327521ea80bbd1e01d | |
parent | 0953f092e8856f06dd5fdff9bd8f19c4eca91e73 (diff) |
Added support for both "environ" and "__environ" global symbols.
-rw-r--r-- | src/library.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/library.js b/src/library.js index 69c69745..1c7d2f50 100644 --- a/src/library.js +++ b/src/library.js @@ -3302,8 +3302,9 @@ LibraryManager.library = { _free(temp); }, + environ: null, __environ: null, - __buildEnvironment__deps: ['__environ'], + __buildEnvironment__deps: ['environ', '__environ'], __buildEnvironment: function(env) { // WARNING: Arbitrary limit! var MAX_ENV_VALUES = 64; @@ -3312,14 +3313,17 @@ LibraryManager.library = { // Statically allocate memory for the environment. var poolPtr; var envPtr; - if (___environ === null) { + if (_environ === null) { + // Allocate memory. poolPtr = allocate(TOTAL_ENV_SIZE, 'i8', ALLOC_STATIC); envPtr = allocate(MAX_ENV_VALUES * {{{ QUANTUM_SIZE }}}, 'i8*', ALLOC_STATIC); {{{ makeSetValue('envPtr', '0', 'poolPtr', 'i8*') }}} - ___environ = allocate([envPtr], 'i8**', ALLOC_STATIC); + _environ = allocate([envPtr], 'i8**', ALLOC_STATIC); + // Set up global variable alias. + ___environ = _environ; } else { - envPtr = {{{ makeGetValue('___environ', '0', 'i8**') }}}; + envPtr = {{{ makeGetValue('_environ', '0', 'i8**') }}}; poolPtr = {{{ makeGetValue('envPtr', '0', 'i8*') }}}; } |