cvs: ZendEngine2 / zend_alloc.c zend_alloc.h zend_constants.c zend_constants.h zend_objects.c zend_variables.c zend_variables.h
| From: | Andi Gutmans | Date: | Sat, 22 Jun 2002 13:52:07 +0000 |
| Subject: | cvs: ZendEngine2 / zend_alloc.c zend_alloc.h zend_constants.c zend_constants.h zend_objects.c zend_variables.c zend_variables.h | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-181@lists.php.net to get a copy of this message | ||
andi Sat Jun 22 09:52:07 2002 EDT
Modified files:
/ZendEngine2 zend_alloc.c zend_alloc.h zend_constants.c
zend_constants.h zend_objects.c zend_variables.c
zend_variables.h
Log:
- Nuke persist_alloc().
Index: ZendEngine2/zend_alloc.c
diff -u ZendEngine2/zend_alloc.c:1.100 ZendEngine2/zend_alloc.c:1.101
--- ZendEngine2/zend_alloc.c:1.100 Wed Jun 19 12:53:06 2002
+++ ZendEngine2/zend_alloc.c Sat Jun 22 09:52:04 2002
@@ -747,29 +747,6 @@
#endif
-ZEND_API int _persist_alloc(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
- zend_mem_header *p = (zend_mem_header *) ((char *)ptr-sizeof(zend_mem_header)-MEM_HEADER_PADDING);
- TSRMLS_FETCH();
-
-#if ZEND_DEBUG
- _mem_block_check(ptr, 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
-#endif
-
- HANDLE_BLOCK_INTERRUPTIONS();
-
- /* remove the block from the non persistent list */
- REMOVE_POINTER_FROM_LIST(p);
-
- p->persistent = 1;
-
- /* add the block to the persistent list */
- ADD_POINTER_TO_LIST(p);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return REAL_SIZE(p->size)+sizeof(zend_mem_header)+MEM_HEADER_PADDING;
-}
-
-
/*
* Local variables:
* tab-width: 4
Index: ZendEngine2/zend_alloc.h
diff -u ZendEngine2/zend_alloc.h:1.36 ZendEngine2/zend_alloc.h:1.37
--- ZendEngine2/zend_alloc.h:1.36 Sun Apr 28 02:24:15 2002
+++ ZendEngine2/zend_alloc.h Sat Jun 22 09:52:04 2002
@@ -79,7 +79,6 @@
ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC
ZEND_FILE_LINE_ORIG_DC);
ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC
ZEND_FILE_LINE_ORIG_DC);
-ZEND_API int _persist_alloc(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
/* Standard wrapper macros */
#define emalloc(size) _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
@@ -89,7 +88,6 @@
#define erealloc_recoverable(ptr, size) _erealloc((ptr), (size), 1 ZEND_FILE_LINE_CC
ZEND_FILE_LINE_EMPTY_CC)
#define estrdup(s) _estrdup((s) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
#define estrndup(s, length) _estrndup((s), (length) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-#define persist_alloc(p) _persist_alloc((p) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
/* Relay wrapper macros */
#define emalloc_rel(size) _emalloc((size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
@@ -99,7 +97,6 @@
#define erealloc_recoverable_rel(ptr, size) _erealloc((ptr), (size), 1 ZEND_FILE_LINE_RELAY_CC
ZEND_FILE_LINE_CC)
#define estrdup_rel(s) _estrdup((s) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
#define estrndup_rel(s, length) _estrndup((s), (length) ZEND_FILE_LINE_RELAY_CC
ZEND_FILE_LINE_CC)
-#define persist_alloc_rel(p) _persist_alloc((p) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
/* Selective persistent/non persistent allocation macros */
#define pemalloc(size, persistent) ((persistent)?malloc(size):emalloc(size))
Index: ZendEngine2/zend_constants.c
diff -u ZendEngine2/zend_constants.c:1.40 ZendEngine2/zend_constants.c:1.41
--- ZendEngine2/zend_constants.c:1.40 Wed Jun 19 00:13:12 2002
+++ ZendEngine2/zend_constants.c Sat Jun 22 09:52:06 2002
@@ -27,8 +27,7 @@
void free_zend_constant(zend_constant *c)
{
- if (!(c->flags & CONST_PERSISTENT)
- || (c->flags & CONST_EFREE_PERSISTENT)) {
+ if (!(c->flags & CONST_PERSISTENT)) {
zval_dtor(&c->value);
}
free(c->name);
@@ -40,9 +39,6 @@
c->name = zend_strndup(c->name, c->name_len);
if (!(c->flags & CONST_PERSISTENT)) {
zval_copy_ctor(&c->value);
- if (c->flags & CONST_EFREE_PERSISTENT) { /* persist_alloc()'d data */
- persist_alloc(&c->value);
- }
}
}
@@ -265,8 +261,7 @@
if (zend_hash_add(EG(zend_constants), lowercase_name, c->name_len, (void *) c,
sizeof(zend_constant), NULL)==FAILURE) {
free(c->name);
- if (!(c->flags & CONST_PERSISTENT)
- || (c->flags & CONST_EFREE_PERSISTENT)) {
+ if (!(c->flags & CONST_PERSISTENT)) {
zval_dtor(&c->value);
}
zend_error(E_NOTICE,"Constant %s already defined", lowercase_name);
Index: ZendEngine2/zend_constants.h
diff -u ZendEngine2/zend_constants.h:1.21 ZendEngine2/zend_constants.h:1.22
--- ZendEngine2/zend_constants.h:1.21 Sun Jan 6 10:21:35 2002
+++ ZendEngine2/zend_constants.h Sat Jun 22 09:52:07 2002
@@ -25,10 +25,6 @@
#define CONST_CS (1<<0) /* Case Sensitive */
#define CONST_PERSISTENT (1<<1) /* Persistent */
-#define CONST_EFREE_PERSISTENT (1<<2) /* In conjunction with CONST_PERSISTENT,
- * means that the constant should be freed
- * using zval_dtor() on shutdown.
- */
typedef struct _zend_constant {
zval value;
Index: ZendEngine2/zend_objects.c
diff -u ZendEngine2/zend_objects.c:1.19 ZendEngine2/zend_objects.c:1.20
--- ZendEngine2/zend_objects.c:1.19 Fri May 31 10:32:19 2002
+++ ZendEngine2/zend_objects.c Sat Jun 22 09:52:07 2002
@@ -43,7 +43,7 @@
zend_objects_call_destructor(object, handle TSRMLS_CC);
/* Nuke the object */
zend_hash_destroy(object->properties);
- efree(object->properties);
+ FREE_HASHTABLE(object->properties);
efree(object);
}
Index: ZendEngine2/zend_variables.c
diff -u ZendEngine2/zend_variables.c:1.45 ZendEngine2/zend_variables.c:1.46
--- ZendEngine2/zend_variables.c:1.45 Fri Mar 15 11:26:17 2002
+++ ZendEngine2/zend_variables.c Sat Jun 22 09:52:07 2002
@@ -138,37 +138,6 @@
}
-ZEND_API int zval_persist(zval *zvalue TSRMLS_DC)
-{
- switch (zvalue->type) {
- case IS_OBJECT:
- case IS_RESOURCE:
- return FAILURE; /* resources and objects cannot be persisted */
- break;
- case IS_BOOL:
- case IS_LONG:
- case IS_NULL:
- break;
- case IS_CONSTANT:
- case IS_STRING:
- if (zvalue->value.str.val) {
- if (zvalue->value.str.len==0) {
- zvalue->value.str.val = empty_string;
- return SUCCESS;
- }
- }
- persist_alloc(zvalue->value.str.val);
- break;
- case IS_ARRAY:
- case IS_CONSTANT_ARRAY:
- persist_alloc(zvalue->value.ht);
- zend_hash_apply(zvalue->value.ht, (apply_func_t) zval_persist TSRMLS_CC);
- break;
- }
- return SUCCESS;
-}
-
-
ZEND_API int zend_print_variable(zval *var)
{
return zend_print_zval(var, 0);
Index: ZendEngine2/zend_variables.h
diff -u ZendEngine2/zend_variables.h:1.22 ZendEngine2/zend_variables.h:1.23
--- ZendEngine2/zend_variables.h:1.22 Sun Jan 6 10:21:36 2002
+++ ZendEngine2/zend_variables.h Sat Jun 22 09:52:07 2002
@@ -32,8 +32,6 @@
#define zval_dtor(zvalue) _zval_dtor((zvalue) ZEND_FILE_LINE_CC)
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
-ZEND_API int zval_persist(zval *zvalue TSRMLS_DC);
-
#if ZEND_DEBUG
ZEND_API int _zval_copy_ctor_wrapper(zval *zvalue);
ZEND_API void _zval_dtor_wrapper(zval *zvalue);