Skip to content
Browse files

Some cleanup

  • Loading branch information...
1 parent 37a3490 commit 7deb44e36d98395af07e629ad9b646e0adb8cf55 @zsuraski zsuraski committed
Showing with 10 additions and 46 deletions.
  1. +2 −2 Zend/zend.c
  2. +4 −3 Zend/zend_execute_API.c
  3. +0 −26 Zend/zend_hash.c
  4. +2 −4 Zend/zend_hash.h
  5. +1 −9 Zend/zend_list.c
  6. +1 −2 Zend/zend_list.h
View
4 Zend/zend.c
@@ -315,7 +315,7 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS
static void executor_globals_dtor(zend_executor_globals *executor_globals TSRMLS_DC)
{
zend_shutdown_constants(TSRMLS_C);
- zend_destroy_rsrc_plist(TSRMLS_C);
+ zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
zend_ini_shutdown(TSRMLS_C);
}
@@ -437,7 +437,7 @@ void zend_shutdown(TSRMLS_D)
zend_shutdown_timeout_thread();
#endif
#ifndef ZTS
- zend_destroy_rsrc_plist();
+ zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
#endif
zend_destroy_rsrc_list_dtors();
zend_hash_destroy(&module_registry);
View
7 Zend/zend_execute_API.c
@@ -177,9 +177,10 @@ void shutdown_executor(TSRMLS_D)
zend_hash_apply(EG(class_table), (apply_func_t) is_not_internal_class TSRMLS_CC);
} zend_end_try();
- zend_destroy_rsrc_list(TSRMLS_C); /* must be destroyed after the main symbol table and
- * op arrays are destroyed.
- */
+ /* The regular list must be destroyed after the main symbol table and
+ * op arrays are destroyed.
+ */
+ zend_destroy_rsrc_list(&EG(regular_list) TSRMLS_CC);
zend_try {
clean_non_persistent_constants(TSRMLS_C);
View
26 Zend/zend_hash.c
@@ -524,32 +524,6 @@ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLen
return FAILURE;
}
-ZEND_API void zend_hash_reverse_destroy(HashTable *ht)
-{
- Bucket *p, *q;
-
- while (1) {
- p = ht->pListTail;
- if (!p) {
- break;
- }
- q = p->pListLast;
- if (q) {
- q->pListNext = NULL;
- }
- ht->pListTail = q;
-
- if (ht->pDestructor) {
- ht->pDestructor(p->pData);
- }
- if (!p->pDataPtr && p->pData) {
- pefree(p->pData, ht->persistent);
- }
- pefree(p, ht->persistent);
- }
- pefree(ht->arBuckets, ht->persistent);
-}
-
ZEND_API void zend_hash_destroy(HashTable *ht)
{
View
6 Zend/zend_hash.h
@@ -37,8 +37,6 @@ typedef ulong (*hash_func_t)(char *arKey, uint nKeyLength);
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 int (*apply_func_t)(void *pDest TSRMLS_DC);
-typedef int (*apply_func_arg_t)(void *pDest, void *argument TSRMLS_DC);
typedef void (*copy_ctor_func_t)(void *pElement);
struct _hashtable;
@@ -81,8 +79,6 @@ BEGIN_EXTERN_C()
ZEND_API int zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, int persistent);
ZEND_API int zend_hash_init_ex(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, int persistent, zend_bool bApplyProtection);
ZEND_API void zend_hash_destroy(HashTable *ht);
-ZEND_API void zend_hash_reverse_destroy(HashTable *ht);
-
ZEND_API void zend_hash_clean(HashTable *ht);
/* additions/updates/changes */
@@ -113,6 +109,8 @@ typedef struct _zend_hash_key {
} zend_hash_key;
+typedef int (*apply_func_t)(void *pDest TSRMLS_DC);
+typedef int (*apply_func_arg_t)(void *pDest, void *argument TSRMLS_DC);
typedef int (*apply_func_args_t)(void *pDest, int num_args, va_list args, zend_hash_key *hash_key);
ZEND_API void zend_hash_graceful_destroy(HashTable *ht);
View
10 Zend/zend_list.c
@@ -228,10 +228,9 @@ int zend_init_rsrc_plist(TSRMLS_D)
}
-void zend_destroy_rsrc_list(TSRMLS_D)
+void zend_destroy_rsrc_list(HashTable *ht TSRMLS_DC)
{
Bucket *p, *q;
- HashTable *ht = &EG(regular_list);
while (1) {
p = ht->pListTail;
@@ -258,13 +257,6 @@ void zend_destroy_rsrc_list(TSRMLS_D)
}
-
-void zend_destroy_rsrc_plist(TSRMLS_D)
-{
- zend_hash_reverse_destroy(&EG(persistent_list));
-}
-
-
static int clean_module_resource(zend_rsrc_list_entry *le, int *resource_id TSRMLS_DC)
{
if (le->type == *resource_id) {
View
3 Zend/zend_list.h
@@ -68,8 +68,7 @@ void plist_entry_destructor(void *ptr);
void zend_clean_module_rsrc_dtors(int module_number TSRMLS_DC);
int zend_init_rsrc_list(TSRMLS_D);
int zend_init_rsrc_plist(TSRMLS_D);
-void zend_destroy_rsrc_list(TSRMLS_D);
-void zend_destroy_rsrc_plist(TSRMLS_D);
+void zend_destroy_rsrc_list(HashTable *ht TSRMLS_DC);
int zend_init_rsrc_list_dtors(void);
void zend_destroy_rsrc_list_dtors(void);

0 comments on commit 7deb44e

Please sign in to comment.
Something went wrong with that request. Please try again.