diff options
author | Andi Gutmans <andi@php.net> | 2004-10-04 19:54:35 +0000 |
---|---|---|
committer | Andi Gutmans <andi@php.net> | 2004-10-04 19:54:35 +0000 |
commit | db507dd153fa668fef95863afee4d04f33b80b85 (patch) | |
tree | 67ffc59fbd97a93c94e37ae6a8cb735b6755e221 /Zend/zend_execute_API.c | |
parent | bb77132391aaeb07daa0e057ea5c11cdb151dfda (diff) | |
download | php-git-db507dd153fa668fef95863afee4d04f33b80b85.tar.gz |
- Commit the variable fetch optimization.
- Extensions which delete global variables need to use new special function
- delete_global_variable() (I'm about to rename it) to remove them.
- Will post to internals@ or via commit messages if there's anything else.
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r-- | Zend/zend_execute_API.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 45d585f596..481d29e260 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1343,6 +1343,27 @@ void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC) } } +ZEND_API int delete_global_variable(char *name, int name_len TSRMLS_DC) +{ + zend_execute_data *ex; + + if (zend_symtable_del(&EG(symbol_table), name, name_len+1) == SUCCESS) { + for (ex = EG(current_execute_data); ex; ex = ex->prev_execute_data) { + if (ex->symbol_table == &EG(symbol_table)) { + int i; + for (i = 0; i < ex->op_array->last_var; i++) { + if (ex->op_array->vars[i].name_len == name_len && + !memcmp(ex->op_array->vars[i].name, name, name_len)) { + ex->CVs[i] = NULL; + break; + } + } + } + } + return SUCCESS; + } + return FAILURE; +} /* * Local variables: |