com php-src: Save memory allocating: Zend/zend_vm_def.h Zend/zend_vm_execute.h
| From: | Xinchen Hui | Date: | Thu, 30 Oct 2014 08:55:40 +0000 |
| Subject: | com php-src: Save memory allocating: Zend/zend_vm_def.h Zend/zend_vm_execute.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-82887@lists.php.net to get a copy of this message | ||
Commit: fced6e614811834d4edda6c0e4af9b769177ef2c
Author: Xinchen Hui <laruence@php.net> Thu, 30 Oct 2014 16:55:40 +0800
Parents: af22cd665cbcbdfa07a3707d0651f719e023f0ec
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fced6e614811834d4edda6c0e4af9b769177ef2c
Log:
Save memory allocating
Changed paths:
M Zend/zend_vm_def.h
M Zend/zend_vm_execute.h
Diff:
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 9f2d26a..fad38c6 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -3775,13 +3775,15 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) {
char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\',
Z_STRLEN_P(opline->op2.zv));
if (!actual) {
- actual = Z_STRVAL_P(opline->op2.zv);
+ ZVAL_STR(EX_VAR(opline->result.var), zend_string_copy(Z_STR_P(opline->op2.zv)));
} else {
actual++;
+ ZVAL_STRINGL(EX_VAR(opline->result.var),
+ actual, Z_STRLEN_P(opline->op2.zv) - (actual - Z_STRVAL_P(opline->op2.zv)));
}
/* non-qualified constant - allow text substitution */
- zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual,
actual);
- ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRLEN_P(opline->op2.zv)-(actual -
Z_STRVAL_P(opline->op2.zv)));
+ zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",
+ Z_STRVAL_P(EX_VAR(opline->result.var)), Z_STRVAL_P(EX_VAR(opline->result.var)));
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 732c3f0...4f305c2 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -4300,13 +4300,15 @@ static int ZEND_FASTCALL
ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) {
char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\',
Z_STRLEN_P(opline->op2.zv));
if (!actual) {
- actual = Z_STRVAL_P(opline->op2.zv);
+ ZVAL_STR(EX_VAR(opline->result.var), zend_string_copy(Z_STR_P(opline->op2.zv)));
} else {
actual++;
+ ZVAL_STRINGL(EX_VAR(opline->result.var),
+ actual, Z_STRLEN_P(opline->op2.zv) - (actual - Z_STRVAL_P(opline->op2.zv)));
}
/* non-qualified constant - allow text substitution */
- zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual,
actual);
- ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRLEN_P(opline->op2.zv)-(actual -
Z_STRVAL_P(opline->op2.zv)));
+ zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",
+ Z_STRVAL_P(EX_VAR(opline->result.var)), Z_STRVAL_P(EX_VAR(opline->result..var)));
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -18950,13 +18952,15 @@ static int ZEND_FASTCALL
ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) {
char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\',
Z_STRLEN_P(opline->op2.zv));
if (!actual) {
- actual = Z_STRVAL_P(opline->op2.zv);
+ ZVAL_STR(EX_VAR(opline->result.var), zend_string_copy(Z_STR_P(opline->op2.zv)));
} else {
actual++;
+ ZVAL_STRINGL(EX_VAR(opline->result.var),
+ actual, Z_STRLEN_P(opline->op2.zv) - (actual - Z_STRVAL_P(opline->op2.zv)));
}
/* non-qualified constant - allow text substitution */
- zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual,
actual);
- ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRLEN_P(opline->op2.zv)-(actual -
Z_STRVAL_P(opline->op2.zv)));
+ zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",
+ Z_STRVAL_P(EX_VAR(opline->result.var)), Z_STRVAL_P(EX_VAR(opline->result.var)));
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -28234,13 +28238,15 @@ static int ZEND_FASTCALL
ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) {
char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\',
Z_STRLEN_P(opline->op2.zv));
if (!actual) {
- actual = Z_STRVAL_P(opline->op2.zv);
+ ZVAL_STR(EX_VAR(opline->result.var), zend_string_copy(Z_STR_P(opline->op2.zv)));
} else {
actual++;
+ ZVAL_STRINGL(EX_VAR(opline->result.var),
+ actual, Z_STRLEN_P(opline->op2.zv) - (actual - Z_STRVAL_P(opline->op2..zv)));
}
/* non-qualified constant - allow text substitution */
- zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual,
actual);
- ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRLEN_P(opline->op2.zv)-(actual -
Z_STRVAL_P(opline->op2.zv)));
+ zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",
+ Z_STRVAL_P(EX_VAR(opline->result.var)), Z_STRVAL_P(EX_VAR(opline->result.var)));
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {