cvs: ZendEngine2(PHP_5_3) / zend_API.c zend_gc.h /tests gc_027.phpt

[email protected] ("Dmitry Stogov")
Newsgroups php.zend-engine.cvs
Message-ID <cvsdmitry1201171766@cvsserver>
dmitry		Thu Jan 24 10:49:26 2008 UTC

  Added files:                 (Branch: PHP_5_3)
    /ZendEngine2/tests	gc_027.phpt 

  Modified files:              
    /ZendEngine2	zend_API.c zend_gc.h 
  Log:
  Fixed GC bug
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.c?r1=1.296.2.27.2.34.2.16&r2=1.296.2.27.2.34.2.17&diff_format=u
Index: ZendEngine2/zend_API.c
diff -u ZendEngine2/zend_API.c:1.296.2.27.2.34.2.16 ZendEngine2/zend_API.c:1.296.2.27.2.34.2.17
--- ZendEngine2/zend_API.c:1.296.2.27.2.34.2.16	Thu Jan 24 09:41:37 2008
+++ ZendEngine2/zend_API.c	Thu Jan 24 10:49:26 2008
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_API.c,v 1.296.2.27.2.34.2.16 2008/01/24 09:41:37 dmitry Exp $ */
+/* $Id: zend_API.c,v 1.296.2.27.2.34.2.17 2008/01/24 10:49:26 dmitry Exp $ */
 
 #include "zend.h"
 #include "zend_execute.h"
@@ -2850,7 +2850,7 @@
 	zval *property;
 
 	if (ce->type & ZEND_INTERNAL_CLASS) {
-		property = malloc(sizeof(zval));
+		ALLOC_PERMANENT_ZVAL(property);
 	} else {
 		ALLOC_ZVAL(property);
 	}
@@ -2864,7 +2864,7 @@
 	zval *property;
 
 	if (ce->type & ZEND_INTERNAL_CLASS) {
-		property = malloc(sizeof(zval));
+		ALLOC_PERMANENT_ZVAL(property);
 	} else {
 		ALLOC_ZVAL(property);
 	}
@@ -2879,7 +2879,7 @@
 	zval *property;
 
 	if (ce->type & ZEND_INTERNAL_CLASS) {
-		property = malloc(sizeof(zval));
+		ALLOC_PERMANENT_ZVAL(property);
 	} else {
 		ALLOC_ZVAL(property);
 	}
@@ -2894,7 +2894,7 @@
 	zval *property;
 
 	if (ce->type & ZEND_INTERNAL_CLASS) {
-		property = malloc(sizeof(zval));
+		ALLOC_PERMANENT_ZVAL(property);
 	} else {
 		ALLOC_ZVAL(property);
 	}
@@ -2910,7 +2910,7 @@
 	int len = strlen(value);
 
 	if (ce->type & ZEND_INTERNAL_CLASS) {
-		property = malloc(sizeof(zval));
+		ALLOC_PERMANENT_ZVAL(property);
 		ZVAL_STRINGL(property, zend_strndup(value, len), len, 0);
 	} else {
 		ALLOC_ZVAL(property);
@@ -2926,7 +2926,7 @@
 	zval *property;
 
 	if (ce->type & ZEND_INTERNAL_CLASS) {
-		property = malloc(sizeof(zval));
+		ALLOC_PERMANENT_ZVAL(property);
 		ZVAL_STRINGL(property, zend_strndup(value, value_len), value_len, 0);
 	} else {
 		ALLOC_ZVAL(property);
@@ -2948,7 +2948,7 @@
 	zval *constant;
 
 	if (ce->type & ZEND_INTERNAL_CLASS) {
-		constant = malloc(sizeof(zval));
+		ALLOC_PERMANENT_ZVAL(constant);
 	} else {
 		ALLOC_ZVAL(constant);
 	}
@@ -2963,7 +2963,7 @@
 	zval *constant;
 
 	if (ce->type & ZEND_INTERNAL_CLASS) {
-		constant = malloc(sizeof(zval));
+		ALLOC_PERMANENT_ZVAL(constant);
 	} else {
 		ALLOC_ZVAL(constant);
 	}
@@ -2978,7 +2978,7 @@
 	zval *constant;
 
 	if (ce->type & ZEND_INTERNAL_CLASS) {
-		constant = malloc(sizeof(zval));
+		ALLOC_PERMANENT_ZVAL(constant);
 	} else {
 		ALLOC_ZVAL(constant);
 	}
@@ -2993,7 +2993,7 @@
 	zval *constant;
 
 	if (ce->type & ZEND_INTERNAL_CLASS) {
-		constant = malloc(sizeof(zval));
+		ALLOC_PERMANENT_ZVAL(constant);
 	} else {
 		ALLOC_ZVAL(constant);
 	}
@@ -3008,7 +3008,7 @@
 	zval *constant;
 
 	if (ce->type & ZEND_INTERNAL_CLASS) {
-		constant = malloc(sizeof(zval));
+		ALLOC_PERMANENT_ZVAL(constant);
 		ZVAL_STRINGL(constant, zend_strndup(value, value_length), value_length, 0);
 	} else {
 		ALLOC_ZVAL(constant);
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_gc.h?r1=1.1.2.1&r2=1.1.2.2&diff_format=u
Index: ZendEngine2/zend_gc.h
diff -u ZendEngine2/zend_gc.h:1.1.2.1 ZendEngine2/zend_gc.h:1.1.2.2
--- ZendEngine2/zend_gc.h:1.1.2.1	Tue Jan 22 09:27:47 2008
+++ ZendEngine2/zend_gc.h	Thu Jan 24 10:49:26 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_gc.h,v 1.1.2.1 2008/01/22 09:27:47 dmitry Exp $ */
+/* $Id: zend_gc.h,v 1.1.2.2 2008/01/24 10:49:26 dmitry Exp $ */
 
 #ifndef ZEND_GC_H
 #define ZEND_GC_H
@@ -199,6 +199,12 @@
 	}
 }
 
+#define ALLOC_PERMANENT_ZVAL(z)							\
+	do {												\
+		(z) = (zval*)malloc(sizeof(zval_gc_info));		\
+		GC_ZVAL_INIT(z);								\
+	} while (0)
+
 /* The following macroses override macroses from zend_alloc.h */
 #undef  ALLOC_ZVAL
 #define ALLOC_ZVAL(z) 									\

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/gc_027.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/gc_027.phpt
+++ ZendEngine2/tests/gc_027.phpt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.