diff options
| author | Zeev Suraski <zeev@php.net> | 2000-01-17 17:33:37 +0000 |
|---|---|---|
| committer | Zeev Suraski <zeev@php.net> | 2000-01-17 17:33:37 +0000 |
| commit | 62114c18068610dc02b7a28e74d3d2957e3315fd (patch) | |
| tree | 53dc05ad4216381535f5985c6f615a432785b962 /Zend | |
| parent | ec386cc9fde380aaa4af823e75950365d8bb98da (diff) | |
| download | php-git-62114c18068610dc02b7a28e74d3d2957e3315fd.tar.gz | |
Destructors no longer return ints, the low level problem it was intended to solve is long gone now...
Diffstat (limited to 'Zend')
| -rw-r--r-- | Zend/zend_compile.c | 5 | ||||
| -rw-r--r-- | Zend/zend_compile.h | 8 | ||||
| -rw-r--r-- | Zend/zend_constants.c | 3 | ||||
| -rw-r--r-- | Zend/zend_constants.h | 4 | ||||
| -rw-r--r-- | Zend/zend_execute_API.c | 3 | ||||
| -rw-r--r-- | Zend/zend_hash.c | 15 | ||||
| -rw-r--r-- | Zend/zend_hash.h | 14 | ||||
| -rw-r--r-- | Zend/zend_list.c | 6 | ||||
| -rw-r--r-- | Zend/zend_list.h | 4 | ||||
| -rw-r--r-- | Zend/zend_modules.h | 2 | ||||
| -rw-r--r-- | Zend/zend_opcode.c | 8 | ||||
| -rw-r--r-- | Zend/zend_variables.c | 13 | ||||
| -rw-r--r-- | Zend/zend_variables.h | 12 |
13 files changed, 42 insertions, 55 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index badda32a90..48f5eafcde 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -79,10 +79,9 @@ static void build_runtime_defined_function_key(zval *result, zval *name, zend_op } -static int zend_open_file_dtor_wrapper(zend_file_handle *fh) +static void zend_open_file_dtor_wrapper(zend_file_handle *fh) { zend_open_file_dtor(fh); - return 1; } @@ -104,7 +103,7 @@ void init_compiler(CLS_D ELS_DC) init_resource_list(ELS_C); CG(unclean_shutdown) = 0; zend_llist_init(&CG(open_files), sizeof(zend_file_handle), (void (*)(void *)) zend_open_file_dtor, 0); - zend_hash_init(&CG(used_files), 5, NULL, (int (*)(void *)) zend_open_file_dtor_wrapper, 0); + zend_hash_init(&CG(used_files), 5, NULL, (void (*)(void *)) zend_open_file_dtor_wrapper, 0); } diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 2b95d352fe..59ffd41009 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -362,12 +362,12 @@ ZEND_API void zend_close_file_handle(zend_file_handle *file_handle CLS_DC); ZEND_API void zend_open_file_dtor(zend_file_handle *fh); END_EXTERN_C() -ZEND_API int destroy_zend_function(zend_function *function); -ZEND_API int destroy_zend_class(zend_class_entry *ce); +ZEND_API void destroy_zend_function(zend_function *function); +ZEND_API void destroy_zend_class(zend_class_entry *ce); void zend_class_add_ref(zend_class_entry *ce); -#define ZEND_FUNCTION_DTOR (int (*)(void *)) destroy_zend_function -#define ZEND_CLASS_DTOR (int (*)(void *)) destroy_zend_class +#define ZEND_FUNCTION_DTOR (void (*)(void *)) destroy_zend_function +#define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class zend_op *get_next_op(zend_op_array *op_array CLS_DC); void init_op(zend_op *op CLS_DC); diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index 6ac7a25fbd..0b95f9f66b 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -25,13 +25,12 @@ #include "zend_globals.h" -int free_zend_constant(zend_constant *c) +void free_zend_constant(zend_constant *c) { if (!(c->flags & CONST_PERSISTENT)) { zval_dtor(&c->value); } free(c->name); - return 1; } diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h index 9722979f94..9ebb7409a0 100644 --- a/Zend/zend_constants.h +++ b/Zend/zend_constants.h @@ -45,7 +45,7 @@ typedef struct _zend_constant { #define REGISTER_MAIN_STRINGL_CONSTANT(name,str,len,flags) zend_register_stringl_constant((name),sizeof(name),(str),(len),(flags),0 ELS_CC) void clean_module_constants(int module_number); -int free_zend_constant(zend_constant *c); +void free_zend_constant(zend_constant *c); int zend_startup_constants(ELS_D); int zend_shutdown_constants(ELS_D); void zend_register_standard_constants(ELS_D); @@ -59,6 +59,6 @@ ZEND_API void zend_register_constant(zend_constant *c ELS_DC); void zend_copy_constants(HashTable *target, HashTable *sourc); void copy_zend_constant(zend_constant *c); -#define ZEND_CONSTANT_DTOR (int (*)(void *)) free_zend_constant +#define ZEND_CONSTANT_DTOR (void (*)(void *)) free_zend_constant #endif diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 8e3c1fcf93..1d06a76e7f 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -206,7 +206,7 @@ ZEND_API inline void safe_free_zval_ptr(zval *p) } -ZEND_API int _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC) +ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC) { #if DEBUG_ZEND>=2 printf("Reducing refcount for %x (%x): %d->%d\n", *zval_ptr, zval_ptr, (*zval_ptr)->refcount, (*zval_ptr)->refcount-1); @@ -216,7 +216,6 @@ ZEND_API int _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC) zval_dtor(*zval_ptr); safe_free_zval_ptr(*zval_ptr); } - return 1; } diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index db53b4ab04..f14da0efe9 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -101,7 +101,7 @@ ZEND_API ulong hashpjw(char *arKey, uint nKeyLength) } -ZEND_API int zend_hash_init(HashTable *ht, uint nSize, ulong(*pHashFunction) (char *arKey, uint nKeyLength), int (*pDestructor) (void *pData),int persistent) +ZEND_API int zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, int persistent) { uint i; @@ -771,7 +771,6 @@ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLen ZEND_API void zend_hash_destroy(HashTable *ht) { Bucket *p, *q; - int delete_bucket; IS_CONSISTENT(ht); @@ -783,19 +782,13 @@ ZEND_API void zend_hash_destroy(HashTable *ht) p = p->pListNext; if (!q->bIsPointer) { if (ht->pDestructor) { - delete_bucket = ht->pDestructor(q->pData); - } else { - delete_bucket = 1; + ht->pDestructor(q->pData); } - if (!q->pDataPtr && q->pData && delete_bucket) { + if (!q->pDataPtr && q->pData) { pefree(q->pData,ht->persistent); } - } else { - delete_bucket = 1; - } - if (delete_bucket) { - pefree(q,ht->persistent); } + pefree(q,ht->persistent); } pefree(ht->arBuckets,ht->persistent); diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index 60ac82d65c..c91f2f4166 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -34,6 +34,11 @@ #define HASH_DEL_KEY 0 #define HASH_DEL_INDEX 1 +typedef int (*compare_func_t)(const void *, const void *); +typedef void (*sort_func_t)(void *, size_t, register size_t, compare_func_t); +typedef void (*dtor_func_t)(void *pDest); +typedef ulong (*hash_func_t)(char *arKey, uint nKeyLength); + struct hashtable; typedef struct bucket { @@ -53,25 +58,22 @@ typedef struct hashtable { uint nHashSizeIndex; uint nNumOfElements; ulong nNextFreeElement; - ulong(*pHashFunction) (char *arKey, uint nKeyLength); + hash_func_t pHashFunction; Bucket *pInternalPointer; /* Used for element traversal */ Bucket *pListHead; Bucket *pListTail; Bucket **arBuckets; - int (*pDestructor) (void *pData); + dtor_func_t pDestructor; unsigned char persistent; #if ZEND_DEBUG int inconsistent; #endif } HashTable; -typedef int (*compare_func_t) (const void *, const void *); -typedef void (*sort_func_t) (void *, size_t, register size_t, compare_func_t); - BEGIN_EXTERN_C() /* startup/shutdown */ -ZEND_API int zend_hash_init(HashTable *ht, uint nSize, ulong(*pHashFunction) (char *arKey, uint nKeyLength), int (*pDestructor) (void *pData), int persistent); +ZEND_API int zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, int persistent); ZEND_API void zend_hash_destroy(HashTable *ht); ZEND_API void zend_hash_clean(HashTable *ht); diff --git a/Zend/zend_list.c b/Zend/zend_list.c index 570ceb31b0..1d64603d33 100644 --- a/Zend/zend_list.c +++ b/Zend/zend_list.c @@ -204,7 +204,7 @@ ZEND_API void *zend_fetch_resource(zval **passed_id, int default_id, char *resou } -int list_entry_destructor(void *ptr) +void list_entry_destructor(void *ptr) { list_entry *le = (list_entry *) ptr; list_destructors_entry *ld; @@ -216,11 +216,10 @@ int list_entry_destructor(void *ptr) } else { zend_error(E_WARNING,"Unknown list entry type in request shutdown (%d)",le->type); } - return 1; } -int plist_entry_destructor(void *ptr) +void plist_entry_destructor(void *ptr) { list_entry *le = (list_entry *) ptr; list_destructors_entry *ld; @@ -232,7 +231,6 @@ int plist_entry_destructor(void *ptr) } else { zend_error(E_WARNING,"Unknown persistent list entry type in module shutdown (%d)",le->type); } - return 1; } diff --git a/Zend/zend_list.h b/Zend/zend_list.h index 816b52e398..c306fc1940 100644 --- a/Zend/zend_list.h +++ b/Zend/zend_list.h @@ -46,8 +46,8 @@ enum list_entry_type { LE_DB=1000 }; -int list_entry_destructor(void *ptr); -int plist_entry_destructor(void *ptr); +void list_entry_destructor(void *ptr); +void plist_entry_destructor(void *ptr); int clean_module_resource_destructors(list_destructors_entry *ld, int *module_number); int init_resource_list(ELS_D); diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h index e028ef2e4f..b9b5ac85c5 100644 --- a/Zend/zend_modules.h +++ b/Zend/zend_modules.h @@ -60,5 +60,5 @@ void module_destructor(zend_module_entry *module); int module_registry_cleanup(zend_module_entry *module); int module_registry_request_startup(zend_module_entry *module); -#define ZEND_MODULE_DTOR (int (*)(void *)) module_destructor +#define ZEND_MODULE_DTOR (void (*)(void *)) module_destructor #endif diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 3f40aad847..4ca0b43eed 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -105,7 +105,7 @@ void init_op_array(zend_op_array *op_array, int initial_ops_size) } -ZEND_API int destroy_zend_function(zend_function *function) +ZEND_API void destroy_zend_function(zend_function *function) { switch (function->type) { case ZEND_USER_FUNCTION: @@ -115,14 +115,13 @@ ZEND_API int destroy_zend_function(zend_function *function) /* do nothing */ break; } - return 1; } -ZEND_API int destroy_zend_class(zend_class_entry *ce) +ZEND_API void destroy_zend_class(zend_class_entry *ce) { if (--(*ce->refcount)>0) { - return 1; + return; } switch (ce->type) { case ZEND_USER_CLASS: @@ -138,7 +137,6 @@ ZEND_API int destroy_zend_class(zend_class_entry *ce) zend_hash_destroy(&ce->default_properties); break; } - return 1; } diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index ae795524cd..99bf710936 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -52,10 +52,10 @@ ZEND_API inline void var_uninit(zval *var) } -ZEND_API int _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC) +ZEND_API void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC) { if (zvalue->type==IS_LONG) { - return 1; + return; } switch(zvalue->type) { case IS_STRING: @@ -84,10 +84,9 @@ ZEND_API int _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC) case IS_BOOL: case IS_NULL: default: - return 1; + return; break; } - return 1; } @@ -169,14 +168,14 @@ ZEND_API int _zval_copy_ctor_wrapper(zval *zvalue) } -ZEND_API int _zval_dtor_wrapper(zval *zvalue) +ZEND_API void _zval_dtor_wrapper(zval *zvalue) { - return zval_dtor(zvalue); + zval_dtor(zvalue); } -ZEND_API int _zval_ptr_dtor_wrapper(zval **zval_ptr) +ZEND_API void _zval_ptr_dtor_wrapper(zval **zval_ptr) { return zval_ptr_dtor(zval_ptr); } diff --git a/Zend/zend_variables.h b/Zend/zend_variables.h index 312939c582..b2488fb3e0 100644 --- a/Zend/zend_variables.h +++ b/Zend/zend_variables.h @@ -26,16 +26,16 @@ ZEND_API int zend_print_variable(zval *var); BEGIN_EXTERN_C() ZEND_API int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC); -ZEND_API int _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC); -ZEND_API int _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC); +ZEND_API void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC); +ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC); #define zval_copy_ctor(zvalue) _zval_copy_ctor((zvalue) ZEND_FILE_LINE_CC) #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) #if ZEND_DEBUG ZEND_API int _zval_copy_ctor_wrapper(zval *zvalue); -ZEND_API int _zval_dtor_wrapper(zval *zvalue); -ZEND_API int _zval_ptr_dtor_wrapper(zval **zval_ptr); +ZEND_API void _zval_dtor_wrapper(zval *zvalue); +ZEND_API void _zval_ptr_dtor_wrapper(zval **zval_ptr); #define zval_copy_ctor_wrapper _zval_copy_ctor_wrapper #define zval_dtor_wrapper _zval_dtor_wrapper #define zval_ptr_dtor_wrapper _zval_ptr_dtor_wrapper @@ -51,8 +51,8 @@ END_EXTERN_C() void zval_add_ref(zval **p); void zval_del_ref(zval **p); -#define ZVAL_DESTRUCTOR (int (*)(void *)) zval_dtor_wrapper -#define ZVAL_PTR_DTOR (int (*)(void *)) zval_ptr_dtor_wrapper +#define ZVAL_DESTRUCTOR (void (*)(void *)) zval_dtor_wrapper +#define ZVAL_PTR_DTOR (void (*)(void *)) zval_ptr_dtor_wrapper #define ZVAL_COPY_CTOR (void (*)(void *)) zval_copy_ctor_wrapper ZEND_API void var_reset(zval *var); |
