com php-src: Drop dead code: Zend/zend_compile.c Zend/zen d_compile.h
| From: | Nikita Popov | Date: | Mon, 21 Jul 2014 20:58:38 +0000 |
| Subject: | com php-src: Drop dead code: Zend/zend_compile.c Zend/zen d_compile.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-80942@lists.php.net to get a copy of this message | ||
Commit: 573d25b5e7c2c9a9524efed33ce135ae3d9ad82a
Author: Nikita Popov <nikic@php.net> Mon, 21 Jul 2014 22:58:38 +0200
Parents: 37ac1b96ed1a553e5de78401f8024372d7207e37
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=573d25b5e7c2c9a9524efed33ce135ae3d9ad82a
Log:
Drop dead code
Changed paths:
M Zend/zend_compile.c
M Zend/zend_compile.h
Diff:
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index dccdf7f..bb967b9 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -3548,89 +3548,6 @@ void zend_do_begin_namespace(znode *name, zend_bool with_bracket TSRMLS_DC)
/* {
}
/* }}} */
-void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{{ */
-{
- zend_string *lcname;
- zval *name, ns, tmp;
- zend_bool warn = 0;
- zend_class_entry *ce;
-
- if (!CG(current_import)) {
- CG(current_import) = emalloc(sizeof(HashTable));
- zend_hash_init(CG(current_import), 8, NULL, ZVAL_PTR_DTOR, 0);
- }
-
- ZVAL_ZVAL(&ns, &ns_name->u.constant, 0, 0);
- if (new_name) {
- name = &new_name->u.constant;
- } else {
- const char *p;
-
- /* The form "use A\B" is eqivalent to "use A\B as B".
- So we extract the last part of compound name to use as a new_name */
- name = &tmp;
- p = zend_memrchr(Z_STRVAL(ns), '\\', Z_STRLEN(ns));
- if (p) {
- ZVAL_STRING(name, p+1);
- } else {
- ZVAL_ZVAL(name, &ns, 1, 0);
- warn = !is_global && Z_TYPE(CG(current_namespace)) == IS_UNDEF;
- }
- }
-
- lcname = STR_ALLOC(Z_STRLEN_P(name), 0);
- zend_str_tolower_copy(lcname->val, Z_STRVAL_P(name), Z_STRLEN_P(name));
-
- if (((Z_STRLEN_P(name) == sizeof("self")-1) &&
- !memcmp(lcname->val, "self", sizeof("self")-1)) ||
- ((Z_STRLEN_P(name) == sizeof("parent")-1) &&
- !memcmp(lcname->val, "parent", sizeof("parent")-1))) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because '%s' is a
special class name", Z_STRVAL(ns), Z_STRVAL_P(name), Z_STRVAL_P(name));
- }
-
- if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
- /* Prefix import name with current namespace name to avoid conflicts with classes */
- zend_string *c_ns_name = STR_ALLOC(Z_STRLEN(CG(current_namespace)) + 1 + Z_STRLEN_P(name), 0);
-
- zend_str_tolower_copy(c_ns_name->val, Z_STRVAL(CG(current_namespace)),
Z_STRLEN(CG(current_namespace)));
- c_ns_name->val[Z_STRLEN(CG(current_namespace))] = '\\';
- memcpy(c_ns_name->val+Z_STRLEN(CG(current_namespace))+1, lcname->val, Z_STRLEN_P(name)+1);
- if (zend_hash_exists(CG(class_table), c_ns_name)) {
- char *tmp2 = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRLEN(ns));
-
- if (Z_STRLEN(ns) != Z_STRLEN(CG(current_namespace)) + 1 + Z_STRLEN_P(name) ||
- memcmp(tmp2, c_ns_name->val, Z_STRLEN(ns))) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in
use", Z_STRVAL(ns), Z_STRVAL_P(name));
- }
- efree(tmp2);
- }
- STR_FREE(c_ns_name);
- } else if ((ce = zend_hash_find_ptr(CG(class_table), lcname)) != NULL &&
- ce->type == ZEND_USER_CLASS &&
- ce->info.user.filename == CG(compiled_filename)) {
- char *c_tmp = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRLEN(ns));
-
- if (Z_STRLEN(ns) != Z_STRLEN_P(name) ||
- memcmp(c_tmp, lcname->val, Z_STRLEN(ns))) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in
use", Z_STRVAL(ns), Z_STRVAL_P(name));
- }
- efree(c_tmp);
- }
-
- if (zend_hash_add(CG(current_import), lcname, &ns) == NULL) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in
use", Z_STRVAL(ns), Z_STRVAL_P(name));
- }
- if (warn) {
- if (!strcmp(Z_STRVAL_P(name), "strict")) {
- zend_error_noreturn(E_COMPILE_ERROR, "You seem to be trying to use a different
language...");
- }
- zend_error(E_WARNING, "The use statement with non-compound name '%s' has no
effect", Z_STRVAL_P(name));
- }
- STR_RELEASE(lcname);
- zval_dtor(name);
-}
-/* }}} */
-
void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int is_function,
zend_bool case_sensitive, HashTable *current_import_sub, HashTable *lookup_table TSRMLS_DC) /* {{{
*/
{
zend_string *lookup_name;
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index d602893..2432580 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -524,7 +524,6 @@ void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRM
void zend_do_begin_namespace(znode *name, zend_bool with_brackets TSRMLS_DC);
void zend_do_end_namespace(TSRMLS_D);
void zend_verify_namespace(TSRMLS_D);
-void zend_do_use(znode *name, znode *new_name, int is_global TSRMLS_DC);
void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int is_function,
zend_bool case_sensitive, HashTable *current_import_sub, HashTable *lookup_table TSRMLS_DC);
void zend_do_use_function(znode *name, znode *new_name, int is_global TSRMLS_DC);
void zend_do_use_const(znode *name, znode *new_name, int is_global TSRMLS_DC);