diff options
author | Martijn Otto <martijn.otto@copernica.com> | 2016-05-17 13:47:20 +0200 |
---|---|---|
committer | Martijn Otto <martijn.otto@copernica.com> | 2016-05-17 13:47:20 +0200 |
commit | dd5f3a635053aa03417cdab1228e03c94b9c3136 (patch) | |
tree | 53178a459fcefdfa551eb501064e70453611788a /zend/globals.cpp | |
parent | 9f2e816c787c30ceeb139623c8dae594c4b4443d (diff) |
Fixed final compilation issues
Diffstat (limited to 'zend/globals.cpp')
-rw-r--r-- | zend/globals.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/zend/globals.cpp b/zend/globals.cpp index 5299c90..ea4e65e 100644 --- a/zend/globals.cpp +++ b/zend/globals.cpp @@ -36,14 +36,14 @@ Globals &GLOBALS = Globals::instance(); */ Global Globals::operator[](const char *name) { - // pointer to a zval - zval **varvalue; - // we need the TSRMLS variable TSRMLS_FETCH(); - + + // retrieve the variable (if it exists) + auto *varvalue = zend_hash_find(&EG(symbol_table), zend_string_init(name, ::strlen(name), 0)); + // check if the variable already exists - if (zend_hash_find(&EG(symbol_table), name, ::strlen(name)+1, (void**)&varvalue) == FAILURE) + if (!varvalue) { // the variable does not already exist, return a global object // that will automatically set the value when it is updated @@ -53,7 +53,7 @@ Global Globals::operator[](const char *name) { // we are in the happy situation that the variable exists, we turn // this value into a reference value, and return that - return Global(name, *varvalue); + return Global(name, varvalue); } } @@ -64,14 +64,14 @@ Global Globals::operator[](const char *name) */ Global Globals::operator[](const std::string &name) { - // pointer to a zval - zval **varvalue; - // we need the TSRMLS variable TSRMLS_FETCH(); - + + // retrieve the variable (if it exists) + auto *varvalue = zend_hash_find(&EG(symbol_table), zend_string_init(name.data(), name.size(), 0)); + // check if the variable already exists - if (zend_hash_find(&EG(symbol_table), name.c_str(), name.size()+1, (void**)&varvalue) == FAILURE) + if (!varvalue) { // the variable does not already exist, return a global object // that will automatically set the value when it is updated @@ -81,7 +81,7 @@ Global Globals::operator[](const std::string &name) { // we are in the happy situation that the variable exists, we turn // this value into a reference value, and return that - return Global(name, *varvalue); + return Global(name, varvalue); } } |