cvs: Zend / zend_alloc.c zend_alloc.h zend_constants.c zend_constants.h zend_variables.c zend_variables.h

From: Date: Sat, 22 Jun 2002 14:11:44 +0000
Subject: cvs: Zend / zend_alloc.c zend_alloc.h zend_constants.c zend_constants.h zend_variables.c zend_variables.h
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-182@lists.php.net to get a copy of this message
andi Sat Jun 22 10:11:44 2002 EDT Modified files: /Zend zend_alloc.c zend_alloc.h zend_constants.c zend_constants.h zend_variables.c zend_variables.h Log: - Nuke persist_alloc() Index: Zend/zend_alloc.c diff -u Zend/zend_alloc.c:1.97 Zend/zend_alloc.c:1.98 --- Zend/zend_alloc.c:1.97 Sat Apr 27 07:49:05 2002 +++ Zend/zend_alloc.c Sat Jun 22 10:11:43 2002 @@ -720,29 +720,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: Zend/zend_alloc.h diff -u Zend/zend_alloc.h:1.36 Zend/zend_alloc.h:1.37 --- Zend/zend_alloc.h:1.36 Sat Apr 27 08:03:53 2002 +++ Zend/zend_alloc.h Sat Jun 22 10:11:43 2002 @@ -78,7 +78,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) @@ -88,7 +87,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) @@ -98,7 +96,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: Zend/zend_constants.c diff -u Zend/zend_constants.c:1.39 Zend/zend_constants.c:1.40 --- Zend/zend_constants.c:1.39 Wed Jun 19 00:15:27 2002 +++ Zend/zend_constants.c Sat Jun 22 10:11:43 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); - } } } @@ -266,8 +262,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: Zend/zend_constants.h diff -u Zend/zend_constants.h:1.21 Zend/zend_constants.h:1.22 --- Zend/zend_constants.h:1.21 Sun Jan 6 10:21:09 2002 +++ Zend/zend_constants.h Sat Jun 22 10:11:43 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: Zend/zend_variables.c diff -u Zend/zend_variables.c:1.41 Zend/zend_variables.c:1.42 --- Zend/zend_variables.c:1.41 Sun Jan 6 10:21:09 2002 +++ Zend/zend_variables.c Sat Jun 22 10:11:43 2002 @@ -133,37 +133,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: Zend/zend_variables.h diff -u Zend/zend_variables.h:1.22 Zend/zend_variables.h:1.23 --- Zend/zend_variables.h:1.22 Sun Jan 6 10:21:09 2002 +++ Zend/zend_variables.h Sat Jun 22 10:11:43 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);

« previous php.zend-engine.cvs (#182) next »