Permalink
Browse files

MFH:

- Renamed zend_do_fetch_class_name() to zend_do_build_full_name() (It is not used only for classes)
- Moved zend_resolve_class_name prototype to zend_compile.h
  • Loading branch information...
1 parent bb03788 commit 9e2894f5ffb03e16590c4f55981de54ba67f3374 @felipensp felipensp committed Mar 25, 2008
Showing with 11 additions and 19 deletions.
  1. +9 −18 Zend/zend_compile.c
  2. +2 −1 Zend/zend_compile.h
View
@@ -31,8 +31,6 @@
ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC);
ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, char *filename TSRMLS_DC);
-void zend_resolve_class_name(znode *class_name, ulong *fetch_type, int check_ns_name TSRMLS_DC);
-
#ifndef ZTS
ZEND_API zend_compiler_globals compiler_globals;
ZEND_API zend_executor_globals executor_globals;
@@ -1671,21 +1669,21 @@ void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC)
}
-void zend_do_fetch_class_name(znode *result, znode *class_name_entry, znode *class_name TSRMLS_DC)
+void zend_do_build_full_name(znode *result, znode *prefix, znode *name TSRMLS_DC)
{
zend_uint length;
if (!result) {
- result = class_name_entry;
+ result = prefix;
} else {
- *result = *class_name_entry;
+ *result = *prefix;
}
- length = sizeof("::")-1 + result->u.constant.value.str.len + class_name->u.constant.value.str.len;
+ length = sizeof("::")-1 + result->u.constant.value.str.len + name->u.constant.value.str.len;
result->u.constant.value.str.val = erealloc(result->u.constant.value.str.val, length+1);
memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len], "::", sizeof("::")-1);
- memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len + sizeof("::")-1], class_name->u.constant.value.str.val, class_name->u.constant.value.str.len+1);
- STR_FREE(class_name->u.constant.value.str.val);
+ memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len + sizeof("::")-1], name->u.constant.value.str.val, name->u.constant.value.str.len+1);
+ STR_FREE(name->u.constant.value.str.val);
result->u.constant.value.str.len = length;
}
@@ -3581,7 +3579,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con
} else if (ZEND_FETCH_CLASS_DEFAULT == type) {
zend_resolve_class_name(constant_container, &fetch_type, 1 TSRMLS_CC);
}
- zend_do_fetch_class_name(NULL, constant_container, constant_name TSRMLS_CC);
+ zend_do_build_full_name(NULL, constant_container, constant_name TSRMLS_CC);
*result = *constant_container;
result->u.constant.type = IS_CONSTANT | fetch_type;
} else if (fetch_type || !zend_constant_ct_subst(result, &constant_name->u.constant TSRMLS_CC)) {
@@ -4702,15 +4700,8 @@ void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRM
Z_STRVAL(result->u.constant) = NULL;
Z_STRLEN(result->u.constant) = 0;
}
- len = Z_STRLEN(result->u.constant) + 2 + Z_STRLEN(name->u.constant);
- Z_STRVAL(result->u.constant) = erealloc(Z_STRVAL(result->u.constant), len + 1);
- Z_STRVAL(result->u.constant)[Z_STRLEN(result->u.constant)] = ':';
- Z_STRVAL(result->u.constant)[Z_STRLEN(result->u.constant)+1] = ':';
- memcpy(Z_STRVAL(result->u.constant)+Z_STRLEN(result->u.constant)+2,
- Z_STRVAL(name->u.constant),
- Z_STRLEN(name->u.constant)+1);
- Z_STRLEN(result->u.constant) = len;
- zval_dtor(&name->u.constant);
+ /* prefix = result */
+ zend_do_build_full_name(NULL, result, name TSRMLS_CC);
}
/* }}} */
View
@@ -342,6 +342,7 @@ ZEND_API char *zend_get_compiled_filename(TSRMLS_D);
ZEND_API int zend_get_compiled_lineno(TSRMLS_D);
ZEND_API int zend_get_scanned_file_offset(TSRMLS_D);
+void zend_resolve_class_name(znode *class_name, ulong *fetch_type, int check_ns_name TSRMLS_DC);
ZEND_API char* zend_get_compiled_variable_name(zend_op_array *op_array, zend_uint var, int* name_len);
#ifdef ZTS
@@ -409,7 +410,7 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC);
void zend_do_clone(znode *result, znode *expr TSRMLS_DC);
void zend_do_begin_dynamic_function_call(znode *function_name, int prefix_len TSRMLS_DC);
void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC);
-void zend_do_fetch_class_name(znode *result, znode *class_entry, znode *class_name TSRMLS_DC);
+void zend_do_build_full_name(znode *result, znode *prefix, znode *name TSRMLS_DC);
int zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC);
void zend_do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC);
void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC);

0 comments on commit 9e2894f

Please sign in to comment.