Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit 9e2894f5ffb03e16590c4f55981de54ba67f3374 1 parent bb03788
Felipe Pena authored March 25, 2008
27  Zend/zend_compile.c
@@ -31,8 +31,6 @@
31 31
 ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC);
32 32
 ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, char *filename TSRMLS_DC);
33 33
 
34  
-void zend_resolve_class_name(znode *class_name, ulong *fetch_type, int check_ns_name TSRMLS_DC);
35  
-
36 34
 #ifndef ZTS
37 35
 ZEND_API zend_compiler_globals compiler_globals;
38 36
 ZEND_API zend_executor_globals executor_globals;
@@ -1671,21 +1669,21 @@ void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC)
1671 1669
 }
1672 1670
 
1673 1671
 
1674  
-void zend_do_fetch_class_name(znode *result, znode *class_name_entry, znode *class_name TSRMLS_DC)
  1672
+void zend_do_build_full_name(znode *result, znode *prefix, znode *name TSRMLS_DC)
1675 1673
 {
1676 1674
 	zend_uint length;
1677 1675
 
1678 1676
 	if (!result) {
1679  
-		result = class_name_entry;
  1677
+		result = prefix;
1680 1678
 	} else {
1681  
-		*result = *class_name_entry;
  1679
+		*result = *prefix;
1682 1680
 	}
1683 1681
 
1684  
-	length = sizeof("::")-1 + result->u.constant.value.str.len + class_name->u.constant.value.str.len;
  1682
+	length = sizeof("::")-1 + result->u.constant.value.str.len + name->u.constant.value.str.len;
1685 1683
 	result->u.constant.value.str.val = erealloc(result->u.constant.value.str.val, length+1);
1686 1684
 	memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len], "::", sizeof("::")-1);
1687  
-	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);
1688  
-	STR_FREE(class_name->u.constant.value.str.val);
  1685
+	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);
  1686
+	STR_FREE(name->u.constant.value.str.val);
1689 1687
 	result->u.constant.value.str.len = length;
1690 1688
 }
1691 1689
 
@@ -3581,7 +3579,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con
3581 3579
 				} else if (ZEND_FETCH_CLASS_DEFAULT == type) {
3582 3580
 					zend_resolve_class_name(constant_container, &fetch_type, 1 TSRMLS_CC);
3583 3581
 				}
3584  
-				zend_do_fetch_class_name(NULL, constant_container, constant_name TSRMLS_CC);
  3582
+				zend_do_build_full_name(NULL, constant_container, constant_name TSRMLS_CC);
3585 3583
 				*result = *constant_container;
3586 3584
 				result->u.constant.type = IS_CONSTANT | fetch_type;
3587 3585
 			} 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
4702 4700
 		Z_STRVAL(result->u.constant) = NULL;
4703 4701
 		Z_STRLEN(result->u.constant) = 0;
4704 4702
 	}
4705  
-	len = Z_STRLEN(result->u.constant) + 2 + Z_STRLEN(name->u.constant);
4706  
-	Z_STRVAL(result->u.constant) = erealloc(Z_STRVAL(result->u.constant), len + 1);
4707  
-	Z_STRVAL(result->u.constant)[Z_STRLEN(result->u.constant)] = ':';
4708  
-	Z_STRVAL(result->u.constant)[Z_STRLEN(result->u.constant)+1] = ':';
4709  
-	memcpy(Z_STRVAL(result->u.constant)+Z_STRLEN(result->u.constant)+2,
4710  
-		Z_STRVAL(name->u.constant),
4711  
-		Z_STRLEN(name->u.constant)+1);
4712  
-	Z_STRLEN(result->u.constant) = len;
4713  
-	zval_dtor(&name->u.constant);
  4703
+	/* prefix = result */
  4704
+	zend_do_build_full_name(NULL, result, name TSRMLS_CC);
4714 4705
 }
4715 4706
 /* }}} */
4716 4707
 
3  Zend/zend_compile.h
@@ -342,6 +342,7 @@ ZEND_API char *zend_get_compiled_filename(TSRMLS_D);
342 342
 ZEND_API int zend_get_compiled_lineno(TSRMLS_D);
343 343
 ZEND_API int zend_get_scanned_file_offset(TSRMLS_D);
344 344
 
  345
+void zend_resolve_class_name(znode *class_name, ulong *fetch_type, int check_ns_name TSRMLS_DC);
345 346
 ZEND_API char* zend_get_compiled_variable_name(zend_op_array *op_array, zend_uint var, int* name_len);
346 347
 
347 348
 #ifdef ZTS
@@ -409,7 +410,7 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC);
409 410
 void zend_do_clone(znode *result, znode *expr TSRMLS_DC);
410 411
 void zend_do_begin_dynamic_function_call(znode *function_name, int prefix_len TSRMLS_DC);
411 412
 void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC);
412  
-void zend_do_fetch_class_name(znode *result, znode *class_entry, znode *class_name TSRMLS_DC);
  413
+void zend_do_build_full_name(znode *result, znode *prefix, znode *name TSRMLS_DC);
413 414
 int zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC);
414 415
 void zend_do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC);
415 416
 void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC);

0 notes on commit 9e2894f

Please sign in to comment.
Something went wrong with that request. Please try again.