}
-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;
}
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);
}
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);
#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;
}
#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);
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
}
-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);
zval_dtor(*zval_ptr);
safe_free_zval_ptr(*zval_ptr);
}
- return 1;
}
}
-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;
ZEND_API void zend_hash_destroy(HashTable *ht)
{
Bucket *p, *q;
- int delete_bucket;
IS_CONSISTENT(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);
#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 {
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);
}
-int list_entry_destructor(void *ptr)
+void list_entry_destructor(void *ptr)
{
list_entry *le = (list_entry *) ptr;
list_destructors_entry *ld;
} 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;
} else {
zend_error(E_WARNING,"Unknown persistent list entry type in module shutdown (%d)",le->type);
}
- return 1;
}
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);
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
}
-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:
/* 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:
zend_hash_destroy(&ce->default_properties);
break;
}
- return 1;
}
}
-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:
case IS_BOOL:
case IS_NULL:
default:
- return 1;
+ return;
break;
}
- return 1;
}
}
-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);
}
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
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);
return r;
}
-static int _free_reg_cache(reg_cache *rc)
+static void _free_reg_cache(reg_cache *rc)
{
regfree(&rc->preg);
- return 1;
}
#undef regfree
static void php_reg_init_globals(php_reg_globals *reg_globals)
{
- zend_hash_init(®_globals->ht_rc, 0, NULL, (int (*)(void *)) _free_reg_cache, 1);
+ zend_hash_init(®_globals->ht_rc, 0, NULL, (void (*)(void *)) _free_reg_cache, 1);
}
static PHP_MINIT_FUNCTION(regex)
}
-static int _php_free_pcre_cache(void *data)
+static void _php_free_pcre_cache(void *data)
{
pcre_cache_entry *pce = (pcre_cache_entry *) data;
pefree(pce->re, 1);
#if HAVE_SETLOCALE
pefree((void*)pce->tables, 1);
#endif
- return 1;
}
} php_shutdown_function_entry;
/* some prototypes for local functions */
-static int user_shutdown_function_dtor(php_shutdown_function_entry *shutdown_function_entry);
+static void user_shutdown_function_dtor(php_shutdown_function_entry *shutdown_function_entry);
pval test_class_get_property(zend_property_reference *property_reference);
int test_class_set_property(zend_property_reference *property_reference, pval *value);
void test_class_call_function(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
#if defined(HAVE_PUTENV)
-static int php_putenv_destructor(putenv_entry *pe)
+static void php_putenv_destructor(putenv_entry *pe)
{
if (pe->previous_value) {
putenv(pe->previous_value);
}
efree(pe->putenv_string);
efree(pe->key);
- return 1;
}
#endif
BG(page_inode) = -1;
BG(page_mtime) = -1;
#ifdef HAVE_PUTENV
- if (zend_hash_init(&BG(putenv_ht), 1, NULL, (int (*)(void *)) php_putenv_destructor, 0) == FAILURE) {
+ if (zend_hash_init(&BG(putenv_ht), 1, NULL, (void (*)(void *)) php_putenv_destructor, 0) == FAILURE) {
return FAILURE;
}
#endif
}
-int user_shutdown_function_dtor(php_shutdown_function_entry *shutdown_function_entry)
+void user_shutdown_function_dtor(php_shutdown_function_entry *shutdown_function_entry)
{
pval retval;
int i;
zval_ptr_dtor(&shutdown_function_entry->arguments[i]);
}
efree(shutdown_function_entry->arguments);
- return 1;
}
convert_to_string(shutdown_function_entry.arguments[0]);
if (!BG(user_shutdown_function_names)) {
BG(user_shutdown_function_names) = (HashTable *) emalloc(sizeof(HashTable));
- zend_hash_init(BG(user_shutdown_function_names), 0, NULL, (int (*)(void *))user_shutdown_function_dtor, 0);
+ zend_hash_init(BG(user_shutdown_function_names), 0, NULL, (void (*)(void *))user_shutdown_function_dtor, 0);
}
for (i=0; i<shutdown_function_entry.arg_count; i++) {
/* {{{ module start/shutdown functions */
/* {{{ php_msock_destroy */
-int php_msock_destroy(int *data)
+void php_msock_destroy(int *data)
{
close(*data);
- return 1;
}
/* }}} */
static void fsock_globals_ctor(FLS_D)
{
zend_hash_init(&FG(ht_fsock_keys), 0, NULL, NULL, 1);
- zend_hash_init(&FG(ht_fsock_socks), 0, NULL, (int (*)(void *))php_msock_destroy, 1);
+ zend_hash_init(&FG(ht_fsock_socks), 0, NULL, (void (*)(void *))php_msock_destroy, 1);
FG(def_chunk_size) = CHUNK_SIZE;
FG(phpsockbuf) = NULL;
}
int php_sockdestroy(int socket);
int php_sock_close(int socket);
size_t php_sock_set_def_chunk_size(size_t size);
-int php_msock_destroy(int *data);
+void php_msock_destroy(int *data);
PHPAPI int connect_nonb(int sockfd, struct sockaddr *addr, socklen_t addrlen, struct timeval *timeout);
return r;
}
-static int _free_reg_cache(reg_cache *rc)
+static void _free_reg_cache(reg_cache *rc)
{
regfree(&rc->preg);
- return 1;
}
#undef regfree
static void php_reg_init_globals(php_reg_globals *reg_globals)
{
- zend_hash_init(®_globals->ht_rc, 0, NULL, (int (*)(void *)) _free_reg_cache, 1);
+ zend_hash_init(®_globals->ht_rc, 0, NULL, (void (*)(void *)) _free_reg_cache, 1);
}
static PHP_MINIT_FUNCTION(regex)
}
-static int pvalue_config_destructor(pval *pvalue)
+static void pvalue_config_destructor(pval *pvalue)
{
if (pvalue->type == IS_STRING && pvalue->value.str.val != empty_string) {
free(pvalue->value.str.val);
}
- return 1;
}
-static int pvalue_browscap_destructor(pval *pvalue)
+static void pvalue_browscap_destructor(pval *pvalue)
{
if (pvalue->type == IS_OBJECT || pvalue->type == IS_ARRAY) {
zend_hash_destroy(pvalue->value.ht);
free(pvalue->value.ht);
}
- return 1;
}
{
PLS_FETCH();
- if (zend_hash_init(&configuration_hash, 0, NULL, (int (*)(void *))pvalue_config_destructor, 1)==FAILURE) {
+ if (zend_hash_init(&configuration_hash, 0, NULL, (void (*)(void *))pvalue_config_destructor, 1)==FAILURE) {
return FAILURE;
}
char *browscap = INI_STR("browscap");
if (browscap) {
- if (zend_hash_init(&browser_hash, 0, NULL, (int (*)(void *))pvalue_browscap_destructor, 1)==FAILURE) {
+ if (zend_hash_init(&browser_hash, 0, NULL, (void (*)(void *))pvalue_browscap_destructor, 1)==FAILURE) {
return FAILURE;
}
/*printf("'%s' (%d)\n",$1.value.str.val,$1.value.str.len+1);*/
tmp.value.ht = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init(tmp.value.ht, 0, NULL, (int (*)(void *))pvalue_config_destructor, 1);
+ zend_hash_init(tmp.value.ht, 0, NULL, (void (*)(void *))pvalue_config_destructor, 1);
tmp.type = IS_OBJECT;
zend_hash_update(activezend_hash_table, $1.value.str.val, $1.value.str.len+1, (void *) &tmp, sizeof(pval), (void **) ¤t_section);
tmp.value.str.val = zend_strndup($1.value.str.val,$1.value.str.len);
}
-static int destroy_per_dir_entry(php_per_dir_entry *per_dir_entry)
+static void destroy_per_dir_entry(php_per_dir_entry *per_dir_entry)
{
free(per_dir_entry->key);
free(per_dir_entry->value);
- return 1;
}
static void copy_per_dir_entry(php_per_dir_entry *per_dir_entry)
HashTable *per_dir_info;
per_dir_info = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init(per_dir_info, 5, NULL, (int (*)(void *)) destroy_per_dir_entry, 1);
+ zend_hash_init(per_dir_info, 5, NULL, (void (*)(void *)) destroy_per_dir_entry, 1);
register_cleanup(p, (void *) per_dir_info, (void (*)(void *)) php_destroy_per_dir_info, (void (*)(void *)) zend_hash_destroy);
return per_dir_info;