From: Antony Dovgal Date: Wed, 11 Jul 2007 11:19:58 +0000 (+0000) Subject: fix folding, CS and WS X-Git-Tag: BEFORE_IMPORT_OF_MYSQLND~247 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dd8af0654af40329bd5daa9e2f73f1cbf64f059a;p=php fix folding, CS and WS --- diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index df41c495e4..93b46e75b6 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -26,17 +26,16 @@ #include "zend_operators.h" #include "zend_globals.h" - -void 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.v); } +/* }}} */ - -void copy_zend_constant(zend_constant *c) +void copy_zend_constant(zend_constant *c) /* {{{ */ { TSRMLS_FETCH(); if (UG(unicode)) { @@ -48,29 +47,29 @@ void copy_zend_constant(zend_constant *c) zval_copy_ctor(&c->value); } } +/* }}} */ - -void zend_copy_constants(HashTable *target, HashTable *source) +void zend_copy_constants(HashTable *target, HashTable *source) /* {{{ */ { zend_constant tmp_constant; zend_hash_copy(target, source, (copy_ctor_func_t) copy_zend_constant, &tmp_constant, sizeof(zend_constant)); } +/* }}} */ - -static int clean_non_persistent_constant(zend_constant *c TSRMLS_DC) +static int clean_non_persistent_constant(zend_constant *c TSRMLS_DC) /* {{{ */ { return (c->flags & CONST_PERSISTENT) ? ZEND_HASH_APPLY_STOP : ZEND_HASH_APPLY_REMOVE; } +/* }}} */ - -static int clean_non_persistent_constant_full(zend_constant *c TSRMLS_DC) +static int clean_non_persistent_constant_full(zend_constant *c TSRMLS_DC) /* {{{ */ { return (c->flags & CONST_PERSISTENT) ? 0 : 1; } +/* }}} */ - -static int clean_module_constant(zend_constant *c, int *module_number TSRMLS_DC) +static int clean_module_constant(zend_constant *c, int *module_number TSRMLS_DC) /* {{{ */ { if (c->module_number == *module_number) { return 1; @@ -78,15 +77,15 @@ static int clean_module_constant(zend_constant *c, int *module_number TSRMLS_DC) return 0; } } +/* }}} */ - -void clean_module_constants(int module_number TSRMLS_DC) +void clean_module_constants(int module_number TSRMLS_DC) /* {{{ */ { zend_hash_apply_with_argument(EG(zend_constants), (apply_func_arg_t) clean_module_constant, (void *) &module_number TSRMLS_CC); } +/* }}} */ - -int zend_startup_constants(TSRMLS_D) +int zend_startup_constants(TSRMLS_D) /* {{{ */ { EG(zend_constants) = (HashTable *) malloc(sizeof(HashTable)); @@ -95,10 +94,9 @@ int zend_startup_constants(TSRMLS_D) } return SUCCESS; } +/* }}} */ - - -void zend_register_standard_constants(TSRMLS_D) +void zend_register_standard_constants(TSRMLS_D) /* {{{ */ { REGISTER_MAIN_LONG_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("E_RECOVERABLE_ERROR", E_RECOVERABLE_ERROR, CONST_PERSISTENT | CONST_CS); @@ -162,17 +160,17 @@ void zend_register_standard_constants(TSRMLS_D) zend_register_constant(&c TSRMLS_CC); } } +/* }}} */ - -int zend_shutdown_constants(TSRMLS_D) +int zend_shutdown_constants(TSRMLS_D) /* {{{ */ { zend_hash_destroy(EG(zend_constants)); free(EG(zend_constants)); return SUCCESS; } +/* }}} */ - -void clean_non_persistent_constants(TSRMLS_D) +void clean_non_persistent_constants(TSRMLS_D) /* {{{ */ { if (EG(full_tables_cleanup)) { zend_hash_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant_full TSRMLS_CC); @@ -180,9 +178,9 @@ void clean_non_persistent_constants(TSRMLS_D) zend_hash_reverse_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC); } } +/* }}} */ - -ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC) +ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC) /* {{{ */ { zend_constant c; @@ -200,9 +198,9 @@ ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, c.module_number = module_number; zend_u_register_constant(ZEND_STR_TYPE, &c TSRMLS_CC); } +/* }}} */ - -ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC) +ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC) /* {{{ */ { zend_constant c; @@ -220,9 +218,9 @@ ZEND_API void zend_register_double_constant(char *name, uint name_len, double dv c.module_number = module_number; zend_u_register_constant(ZEND_STR_TYPE, &c TSRMLS_CC); } +/* }}} */ - -ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC) +ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC) /* {{{ */ { zend_constant c; @@ -252,15 +250,15 @@ ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *st c.module_number = module_number; zend_u_register_constant(ZEND_STR_TYPE, &c TSRMLS_CC); } +/* }}} */ - -ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC) +ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC) /* {{{ */ { zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number TSRMLS_CC); } +/* }}} */ - -ZEND_API int zend_u_get_constant(zend_uchar type, zstr name, uint name_len, zval *result, zend_class_entry *scope TSRMLS_DC) +ZEND_API int zend_u_get_constant(zend_uchar type, zstr name, uint name_len, zval *result, zend_class_entry *scope TSRMLS_DC) /* {{{ */ { zend_constant *c; int retval = 1; @@ -381,13 +379,15 @@ ZEND_API int zend_u_get_constant(zend_uchar type, zstr name, uint name_len, zval return retval; } +/* }}} */ -ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC) +ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC) /* {{{ */ { return zend_u_get_constant(IS_STRING, ZSTR(name), name_len, result, NULL TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_u_register_constant(zend_uchar type, zend_constant *c TSRMLS_DC) +ZEND_API int zend_u_register_constant(zend_uchar type, zend_constant *c TSRMLS_DC) /* {{{ */ { unsigned int lookup_name_len; zstr lookup_name; @@ -428,8 +428,9 @@ ZEND_API int zend_u_register_constant(zend_uchar type, zend_constant *c TSRMLS_D } return ret; } +/* }}} */ -ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC) +ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC) /* {{{ */ { if (UG(unicode)) { UChar *ustr; @@ -452,6 +453,8 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC) return zend_u_register_constant(IS_STRING, c TSRMLS_CC); } } +/* }}} */ + /* * Local variables: * tab-width: 4 diff --git a/Zend/zend_default_classes.c b/Zend/zend_default_classes.c index a47402d68a..08aa141d0c 100644 --- a/Zend/zend_default_classes.c +++ b/Zend/zend_default_classes.c @@ -25,14 +25,14 @@ #include "zend_interfaces.h" #include "zend_exceptions.h" - -ZEND_API void zend_register_default_classes(TSRMLS_D) +ZEND_API void zend_register_default_classes(TSRMLS_D) /* {{{ */ { zend_register_interfaces(TSRMLS_C); zend_register_default_exception(TSRMLS_C); zend_register_unicode_exceptions(TSRMLS_C); zend_register_iterator_wrapper(TSRMLS_C); } +/* }}} */ /* * Local variables: diff --git a/Zend/zend_dynamic_array.c b/Zend/zend_dynamic_array.c index 34fc0f9e0e..3798d99755 100644 --- a/Zend/zend_dynamic_array.c +++ b/Zend/zend_dynamic_array.c @@ -28,7 +28,7 @@ typedef struct _dynamic_array { unsigned int allocated; } dynamic_array; -ZEND_API int zend_dynamic_array_init(dynamic_array *da, unsigned int element_size, unsigned int size) +ZEND_API int zend_dynamic_array_init(dynamic_array *da, unsigned int element_size, unsigned int size) /* {{{ */ { da->element_size = element_size; da->allocated = size; @@ -39,8 +39,9 @@ ZEND_API int zend_dynamic_array_init(dynamic_array *da, unsigned int element_siz } return 0; } +/* }}} */ -ZEND_API void *zend_dynamic_array_push(dynamic_array *da) +ZEND_API void *zend_dynamic_array_push(dynamic_array *da) /* {{{ */ { if (da->current == da->allocated) { da->allocated *= 2; @@ -48,20 +49,23 @@ ZEND_API void *zend_dynamic_array_push(dynamic_array *da) } return (void *)(da->array+(da->current++)*da->element_size); } +/* }}} */ -ZEND_API void *zend_dynamic_array_pop(dynamic_array *da) +ZEND_API void *zend_dynamic_array_pop(dynamic_array *da) /* {{{ */ { return (void *)(da->array+(--(da->current))*da->element_size); } +/* }}} */ -ZEND_API void *zend_dynamic_array_get_element(dynamic_array *da, unsigned int index) +ZEND_API void *zend_dynamic_array_get_element(dynamic_array *da, unsigned int index) /* {{{ */ { if (index >= da->current) { return NULL; } return (void *)(da->array+index*da->element_size); } +/* }}} */ /* * Local variables: diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 8a761db62e..8cd0724bfb 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -65,7 +65,7 @@ static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_ #define TEMP_VAR_STACK_LIMIT 2000 -static inline void zend_pzval_unlock_func(zval *z, zend_free_op *should_free, int unref) +static inline void zend_pzval_unlock_func(zval *z, zend_free_op *should_free, int unref) /* {{{ */ { if (!--z->refcount) { z->refcount = 1; @@ -79,14 +79,16 @@ static inline void zend_pzval_unlock_func(zval *z, zend_free_op *should_free, in } } } +/* }}} */ -static inline void zend_pzval_unlock_free_func(zval *z) +static inline void zend_pzval_unlock_free_func(zval *z) /* {{{ */ { if (!--z->refcount) { zval_dtor(z); safe_free_zval_ptr(z); } } +/* }}} */ #define PZVAL_UNLOCK(z, f) zend_pzval_unlock_func(z, f, 1) #define PZVAL_UNLOCK_EX(z, f, u) zend_pzval_unlock_func(z, f, u) @@ -148,25 +150,28 @@ static inline void zend_pzval_unlock_free_func(zval *z) #define CV_OF(i) (EG(current_execute_data)->CVs[i]) #define CV_DEF_OF(i) (EG(active_op_array)->vars[i]) -ZEND_API zval** zend_get_compiled_variable_value(zend_execute_data *execute_data_ptr, zend_uint var) +ZEND_API zval** zend_get_compiled_variable_value(zend_execute_data *execute_data_ptr, zend_uint var) /* {{{ */ { return execute_data_ptr->CVs[var]; } +/* }}} */ -static inline void zend_get_cv_address(zend_uchar utype, zend_compiled_variable *cv, zval ***ptr, temp_variable *Ts TSRMLS_DC) +static inline void zend_get_cv_address(zend_uchar utype, zend_compiled_variable *cv, zval ***ptr, temp_variable *Ts TSRMLS_DC) /* {{{ */ { zval *new_zval = &EG(uninitialized_zval); new_zval->refcount++; zend_u_hash_quick_update(EG(active_symbol_table), utype, cv->name, cv->name_len+1, cv->hash_value, &new_zval, sizeof(zval *), (void **)ptr); } +/* }}} */ -static inline zval *_get_zval_ptr_tmp(znode *node, temp_variable *Ts, zend_free_op *should_free TSRMLS_DC) +static inline zval *_get_zval_ptr_tmp(znode *node, temp_variable *Ts, zend_free_op *should_free TSRMLS_DC) /* {{{ */ { return should_free->var = &T(node->u.var).tmp_var; } +/* }}} */ -static inline zval *_get_zval_ptr_var(znode *node, temp_variable *Ts, zend_free_op *should_free TSRMLS_DC) +static inline zval *_get_zval_ptr_var(znode *node, temp_variable *Ts, zend_free_op *should_free TSRMLS_DC) /* {{{ */ { if (T(node->u.var).var.ptr) { PZVAL_UNLOCK(T(node->u.var).var.ptr, should_free); @@ -218,8 +223,9 @@ static inline zval *_get_zval_ptr_var(znode *node, temp_variable *Ts, zend_free_ return ptr; } } +/* }}} */ -static inline zval *_get_zval_ptr_cv(znode *node, temp_variable *Ts, int type TSRMLS_DC) +static inline zval *_get_zval_ptr_cv(znode *node, temp_variable *Ts, int type TSRMLS_DC) /* {{{ */ { zval ***ptr = &CV_OF(node->u.var); @@ -247,8 +253,9 @@ static inline zval *_get_zval_ptr_cv(znode *node, temp_variable *Ts, int type TS } return **ptr; } +/* }}} */ -static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) +static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) /* {{{ */ { /* should_free->is_var = 0; */ switch (node->op_type) { @@ -275,8 +282,9 @@ static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, zend_free_op * } return NULL; } +/* }}} */ -static inline zval **_get_zval_ptr_ptr_var(znode *node, temp_variable *Ts, zend_free_op *should_free TSRMLS_DC) +static inline zval **_get_zval_ptr_ptr_var(znode *node, temp_variable *Ts, zend_free_op *should_free TSRMLS_DC) /* {{{ */ { zval** ptr_ptr = T(node->u.var).var.ptr_ptr; @@ -288,8 +296,9 @@ static inline zval **_get_zval_ptr_ptr_var(znode *node, temp_variable *Ts, zend_ } return ptr_ptr; } +/* }}} */ -static inline zval **_get_zval_ptr_ptr_cv(znode *node, temp_variable *Ts, int type TSRMLS_DC) +static inline zval **_get_zval_ptr_ptr_cv(znode *node, temp_variable *Ts, int type TSRMLS_DC) /* {{{ */ { zval ***ptr = &CV_OF(node->u.var); @@ -317,8 +326,9 @@ static inline zval **_get_zval_ptr_ptr_cv(znode *node, temp_variable *Ts, int ty } return *ptr; } +/* }}} */ -static inline zval **_get_zval_ptr_ptr(znode *node, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) +static inline zval **_get_zval_ptr_ptr(znode *node, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) /* {{{ */ { if (node->op_type == IS_CV) { should_free->var = 0; @@ -330,8 +340,9 @@ static inline zval **_get_zval_ptr_ptr(znode *node, temp_variable *Ts, zend_free return NULL; } } +/* }}} */ -static inline zval *_get_obj_zval_ptr_unused(TSRMLS_D) +static inline zval *_get_obj_zval_ptr_unused(TSRMLS_D) /* {{{ */ { if (EG(This)) { return EG(This); @@ -340,8 +351,9 @@ static inline zval *_get_obj_zval_ptr_unused(TSRMLS_D) return NULL; } } +/* }}} */ -static inline zval **_get_obj_zval_ptr_ptr(znode *op, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) +static inline zval **_get_obj_zval_ptr_ptr(znode *op, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) /* {{{ */ { if (op->op_type == IS_UNUSED) { if (EG(This)) { @@ -355,8 +367,9 @@ static inline zval **_get_obj_zval_ptr_ptr(znode *op, temp_variable *Ts, zend_fr } return get_zval_ptr_ptr(op, Ts, should_free, type); } +/* }}} */ -static inline zval **_get_obj_zval_ptr_ptr_unused(TSRMLS_D) +static inline zval **_get_obj_zval_ptr_ptr_unused(TSRMLS_D) /* {{{ */ { if (EG(This)) { return &EG(This); @@ -365,8 +378,9 @@ static inline zval **_get_obj_zval_ptr_ptr_unused(TSRMLS_D) return NULL; } } +/* }}} */ -static inline zval *_get_obj_zval_ptr(znode *op, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) +static inline zval *_get_obj_zval_ptr(znode *op, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) /* {{{ */ { if (op->op_type == IS_UNUSED) { if (EG(This)) { @@ -378,8 +392,9 @@ static inline zval *_get_obj_zval_ptr(znode *op, temp_variable *Ts, zend_free_op } return get_zval_ptr(op, Ts, should_free, type); } +/* }}} */ -static inline void zend_switch_free(zend_op *opline, temp_variable *Ts TSRMLS_DC) +static inline void zend_switch_free(zend_op *opline, temp_variable *Ts TSRMLS_DC) /* {{{ */ { switch (opline->op1.op_type) { case IS_VAR: @@ -402,8 +417,9 @@ static inline void zend_switch_free(zend_op *opline, temp_variable *Ts TSRMLS_DC EMPTY_SWITCH_DEFAULT_CASE() } } +/* }}} */ -static void zend_assign_to_variable_reference(zval **variable_ptr_ptr, zval **value_ptr_ptr TSRMLS_DC) +static void zend_assign_to_variable_reference(zval **variable_ptr_ptr, zval **value_ptr_ptr TSRMLS_DC) /* {{{ */ { zval *variable_ptr; zval *value_ptr; @@ -452,8 +468,9 @@ static void zend_assign_to_variable_reference(zval **variable_ptr_ptr, zval **va (*variable_ptr_ptr)->is_ref = 1; } } +/* }}} */ -static inline void make_real_object(zval **object_ptr TSRMLS_DC) +static inline void make_real_object(zval **object_ptr TSRMLS_DC) /* {{{ */ { /* this should modify object only if it's empty */ if (Z_TYPE_PP(object_ptr) == IS_NULL @@ -468,8 +485,9 @@ static inline void make_real_object(zval **object_ptr TSRMLS_DC) object_init(*object_ptr); } } +/* }}} */ -static inline char * zend_verify_arg_class_kind(zend_arg_info *cur_arg_info, zstr *class_name, zend_class_entry **pce TSRMLS_DC) +static inline char * zend_verify_arg_class_kind(zend_arg_info *cur_arg_info, zstr *class_name, zend_class_entry **pce TSRMLS_DC) /* {{{ */ { *pce = zend_u_fetch_class(UG(unicode) ? IS_UNICODE : IS_STRING, cur_arg_info->class_name, cur_arg_info->class_name_len, (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD) TSRMLS_CC); @@ -480,8 +498,9 @@ static inline char * zend_verify_arg_class_kind(zend_arg_info *cur_arg_info, zst return "be an instance of "; } } +/* }}} */ -static inline int zend_verify_arg_error(zend_function *zf, zend_uint arg_num, zend_arg_info *cur_arg_info, char *need_msg, zstr need_kind, char *given_msg, zstr given_kind TSRMLS_DC) +static inline int zend_verify_arg_error(zend_function *zf, zend_uint arg_num, zend_arg_info *cur_arg_info, char *need_msg, zstr need_kind, char *given_msg, zstr given_kind TSRMLS_DC) /* {{{ */ { zend_execute_data *ptr = EG(current_execute_data)->prev_execute_data; zstr fname = zf->common.function_name; @@ -503,8 +522,9 @@ static inline int zend_verify_arg_error(zend_function *zf, zend_uint arg_num, ze } return 0; } +/* }}} */ -static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg TSRMLS_DC) +static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg TSRMLS_DC) /* {{{ */ { zend_arg_info *cur_arg_info; char *need_msg; @@ -542,9 +562,9 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva } return 1; } +/* }}} */ - -static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode *op2, znode *value_op, temp_variable *Ts, int opcode TSRMLS_DC) +static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode *op2, znode *value_op, temp_variable *Ts, int opcode TSRMLS_DC) /* {{{ */ { zval *object; zend_free_op free_op2, free_value; @@ -631,9 +651,9 @@ static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode zval_ptr_dtor(&value); FREE_OP_IF_VAR(free_value); } +/* }}} */ - -static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2, zval *value, int type, temp_variable *Ts TSRMLS_DC) +static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2, zval *value, int type, temp_variable *Ts TSRMLS_DC) /* {{{ */ { zend_free_op free_op1; zval **variable_ptr_ptr = get_zval_ptr_ptr(op1, Ts, &free_op1, BP_VAR_W); @@ -863,41 +883,42 @@ done_setting_var: } FREE_OP_VAR_PTR(free_op1); } +/* }}} */ - -static inline void zend_receive(zval **variable_ptr_ptr, zval *value TSRMLS_DC) +static inline void zend_receive(zval **variable_ptr_ptr, zval *value TSRMLS_DC) /* {{{ */ { (*variable_ptr_ptr)->refcount--; *variable_ptr_ptr = value; value->refcount++; } +/* }}} */ /* Utility Functions for Extensions */ -static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) +static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) /* {{{ */ { if (extension->statement_handler) { extension->statement_handler(op_array); } } +/* }}} */ - -static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) +static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) /* {{{ */ { if (extension->fcall_begin_handler) { extension->fcall_begin_handler(op_array); } } +/* }}} */ - -static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) +static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) /* {{{ */ { if (extension->fcall_end_handler) { extension->fcall_end_handler(op_array); } } +/* }}} */ - -static inline HashTable *zend_get_target_symbol_table(zend_op *opline, temp_variable *Ts, int type, zval *variable TSRMLS_DC) +static inline HashTable *zend_get_target_symbol_table(zend_op *opline, temp_variable *Ts, int type, zval *variable TSRMLS_DC) /* {{{ */ { switch (opline->op2.u.EA.type) { case ZEND_FETCH_LOCAL: @@ -919,8 +940,9 @@ static inline HashTable *zend_get_target_symbol_table(zend_op *opline, temp_vari } return NULL; } +/* }}} */ -static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, zval *dim, int type TSRMLS_DC) +static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, zval *dim, int type TSRMLS_DC) /* {{{ */ { zval **retval; zstr offset_key; @@ -1032,8 +1054,9 @@ fetch_string_dim: } return retval; } +/* }}} */ -static void zend_fetch_dimension_address(temp_variable *result, zval **container_ptr, zval *dim, int dim_is_tmp_var, int type TSRMLS_DC) +static void zend_fetch_dimension_address(temp_variable *result, zval **container_ptr, zval *dim, int dim_is_tmp_var, int type TSRMLS_DC) /* {{{ */ { zval *container; @@ -1234,8 +1257,9 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container AI_USE_PTR(result->var); } } +/* }}} */ -static void zend_fetch_property_address(temp_variable *result, zval **container_ptr, zval *prop_ptr, int type TSRMLS_DC) +static void zend_fetch_property_address(temp_variable *result, zval **container_ptr, zval *prop_ptr, int type TSRMLS_DC) /* {{{ */ { zval *container; @@ -1313,8 +1337,9 @@ static void zend_fetch_property_address(temp_variable *result, zval **container_ PZVAL_LOCK(*result->var.ptr_ptr); } } +/* }}} */ -static inline zend_brk_cont_element* zend_brk_cont(int nest_levels, int array_offset, zend_op_array *op_array, temp_variable *Ts TSRMLS_DC) +static inline zend_brk_cont_element* zend_brk_cont(int nest_levels, int array_offset, zend_op_array *op_array, temp_variable *Ts TSRMLS_DC) /* {{{ */ { int original_nest_levels; zend_brk_cont_element *jmp_to; @@ -1341,6 +1366,7 @@ static inline zend_brk_cont_element* zend_brk_cont(int nest_levels, int array_of } while (--nest_levels > 0); return jmp_to; } +/* }}} */ #if ZEND_INTENSIVE_DEBUGGING @@ -1350,7 +1376,7 @@ static inline zend_brk_cont_element* zend_brk_cont(int nest_levels, int array_of zend_hash_apply(EG(active_symbol_table), (apply_func_t) zend_check_symbol TSRMLS_CC); \ } -static int zend_check_symbol(zval **pz TSRMLS_DC) +static int zend_check_symbol(zval **pz TSRMLS_DC) /* {{{ */ { if (Z_TYPE_PP(pz) > 9) { fprintf(stderr, "Warning! %x has invalid type!\n", *pz); @@ -1364,7 +1390,7 @@ static int zend_check_symbol(zval **pz TSRMLS_DC) return 0; } - +/* }}} */ #else #define CHECK_SYMBOL_TABLES() @@ -1372,11 +1398,12 @@ static int zend_check_symbol(zval **pz TSRMLS_DC) ZEND_API opcode_handler_t *zend_opcode_handlers; -ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC) +ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC) /* {{{ */ { zval **return_value_ptr = &(*(temp_variable *)((char *) execute_data_ptr->Ts + execute_data_ptr->opline->result.u.var)).var.ptr; ((zend_internal_function *) execute_data_ptr->function_state.function)->handler(execute_data_ptr->opline->extended_value, *return_value_ptr, return_value_ptr, execute_data_ptr->object, return_value_used TSRMLS_CC); } +/* }}} */ #define ZEND_VM_NEXT_OPCODE() \ CHECK_SYMBOL_TABLES() \ @@ -1411,7 +1438,7 @@ ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, int return_v #include "zend_vm_execute.h" -ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, opcode_handler_t handler) +ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, opcode_handler_t handler) /* {{{ */ { if (opcode != ZEND_USER_OPCODE) { zend_user_opcodes[opcode] = ZEND_USER_OPCODE; @@ -1420,19 +1447,23 @@ ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, opcode_handler_t ha } return FAILURE; } +/* }}} */ -ZEND_API opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode) +ZEND_API opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode) /* {{{ */ { return zend_user_opcode_handlers[opcode]; } +/* }}} */ -ZEND_API zval *zend_get_zval_ptr(znode *node, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) { +ZEND_API zval *zend_get_zval_ptr(znode *node, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) { /* {{{ */ return get_zval_ptr(node, Ts, should_free, type); } +/* }}} */ -ZEND_API zval **zend_get_zval_ptr_ptr(znode *node, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) { +ZEND_API zval **zend_get_zval_ptr_ptr(znode *node, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC) { /* {{{ */ return get_zval_ptr_ptr(node, Ts, should_free, type); } +/* }}} */ /* * Local variables: diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 4b76e9beba..ad8c2fdc44 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -66,7 +66,7 @@ void init_unicode_strings() { #if 0&&ZEND_DEBUG static void (*original_sigsegv_handler)(int); -static void zend_handle_sigsegv(int dummy) +static void zend_handle_sigsegv(int dummy) /* {{{ */ { fflush(stdout); fflush(stderr); @@ -89,50 +89,50 @@ static void zend_handle_sigsegv(int dummy) original_sigsegv_handler(dummy); } } +/* }}} */ #endif - -static void zend_extension_activator(zend_extension *extension TSRMLS_DC) +static void zend_extension_activator(zend_extension *extension TSRMLS_DC) /* {{{ */ { if (extension->activate) { extension->activate(); } } +/* }}} */ - -static void zend_extension_deactivator(zend_extension *extension TSRMLS_DC) +static void zend_extension_deactivator(zend_extension *extension TSRMLS_DC) /* {{{ */ { if (extension->deactivate) { extension->deactivate(); } } +/* }}} */ - -static int clean_non_persistent_function(zend_function *function TSRMLS_DC) +static int clean_non_persistent_function(zend_function *function TSRMLS_DC) /* {{{ */ { return (function->type == ZEND_INTERNAL_FUNCTION) ? ZEND_HASH_APPLY_STOP : ZEND_HASH_APPLY_REMOVE; } +/* }}} */ - -static int clean_non_persistent_function_full(zend_function *function TSRMLS_DC) +static int clean_non_persistent_function_full(zend_function *function TSRMLS_DC) /* {{{ */ { return (function->type != ZEND_INTERNAL_FUNCTION); } +/* }}} */ - -static int clean_non_persistent_class(zend_class_entry **ce TSRMLS_DC) +static int clean_non_persistent_class(zend_class_entry **ce TSRMLS_DC) /* {{{ */ { return ((*ce)->type == ZEND_INTERNAL_CLASS) ? ZEND_HASH_APPLY_STOP : ZEND_HASH_APPLY_REMOVE; } +/* }}} */ - -static int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC) +static int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC) /* {{{ */ { return ((*ce)->type != ZEND_INTERNAL_CLASS); } +/* }}} */ - -void init_executor(TSRMLS_D) +void init_executor(TSRMLS_D) /* {{{ */ { INIT_ZVAL(EG(uninitialized_zval)); /* trick to make uninitialized_zval never be modified, passed by ref, etc. */ @@ -207,8 +207,9 @@ void init_executor(TSRMLS_D) EG(active) = 1; } +/* }}} */ -static int zval_call_destructor(zval **zv TSRMLS_DC) +static int zval_call_destructor(zval **zv TSRMLS_DC) /* {{{ */ { if (Z_TYPE_PP(zv) == IS_OBJECT && (*zv)->refcount == 1) { return ZEND_HASH_APPLY_REMOVE; @@ -216,8 +217,10 @@ static int zval_call_destructor(zval **zv TSRMLS_DC) return ZEND_HASH_APPLY_KEEP; } } +/* }}} */ -void shutdown_destructors(TSRMLS_D) { +void shutdown_destructors(TSRMLS_D) /* {{{ */ +{ zend_try { int symbols; do { @@ -230,8 +233,9 @@ void shutdown_destructors(TSRMLS_D) { zend_objects_store_mark_destructed(&EG(objects_store) TSRMLS_CC); } zend_end_try(); } +/* }}} */ -void shutdown_executor(TSRMLS_D) +void shutdown_executor(TSRMLS_D) /* {{{ */ { zend_try { /* Removed because this can not be safely done, e.g. in this situation: @@ -345,10 +349,10 @@ void shutdown_executor(TSRMLS_D) } zend_end_try(); EG(active) = 0; } - +/* }}} */ /* return class name and "::" or "". */ -ZEND_API zstr get_active_class_name(char **space TSRMLS_DC) +ZEND_API zstr get_active_class_name(char **space TSRMLS_DC) /* {{{ */ { if (!zend_is_executing(TSRMLS_C)) { if (space) { @@ -374,9 +378,9 @@ ZEND_API zstr get_active_class_name(char **space TSRMLS_DC) return EMPTY_ZSTR; } } +/* }}} */ - -ZEND_API zstr get_active_function_name(TSRMLS_D) +ZEND_API zstr get_active_function_name(TSRMLS_D) /* {{{ */ { zstr ret; @@ -404,9 +408,9 @@ ZEND_API zstr get_active_function_name(TSRMLS_D) return NULL_ZSTR; } } +/* }}} */ - -ZEND_API char *zend_get_executed_filename(TSRMLS_D) +ZEND_API char *zend_get_executed_filename(TSRMLS_D) /* {{{ */ { if (EG(active_op_array)) { return EG(active_op_array)->filename; @@ -414,9 +418,9 @@ ZEND_API char *zend_get_executed_filename(TSRMLS_D) return "[no active file]"; } } +/* }}} */ - -ZEND_API uint zend_get_executed_lineno(TSRMLS_D) +ZEND_API uint zend_get_executed_lineno(TSRMLS_D) /* {{{ */ { if (EG(opline_ptr)) { return active_opline->lineno; @@ -424,15 +428,15 @@ ZEND_API uint zend_get_executed_lineno(TSRMLS_D) return 0; } } +/* }}} */ - -ZEND_API zend_bool zend_is_executing(TSRMLS_D) +ZEND_API zend_bool zend_is_executing(TSRMLS_D) /* {{{ */ { return EG(in_execution); } +/* }}} */ - -ZEND_API void _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); @@ -445,9 +449,9 @@ ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC) (*zval_ptr)->is_ref = 0; } } +/* }}} */ - -ZEND_API void _zval_internal_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC) +ZEND_API void _zval_internal_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); @@ -460,12 +464,13 @@ ZEND_API void _zval_internal_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC) (*zval_ptr)->is_ref = 0; } } +/* }}} */ - -ZEND_API int zend_is_true(zval *op) +ZEND_API int zend_is_true(zval *op) /* {{{ */ { return i_zend_is_true(op); } +/* }}} */ #include "../TSRM/tsrm_strtok_r.h" @@ -473,7 +478,7 @@ ZEND_API int zend_is_true(zval *op) #define IS_CONSTANT_VISITED(p) (Z_TYPE_P(p) & IS_VISITED_CONSTANT) #define MARK_CONSTANT_VISITED(p) Z_TYPE_P(p) |= IS_VISITED_CONSTANT -ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC) +ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC) /* {{{ */ { zval *p = *pp; zend_bool inline_change = (zend_bool) (zend_uintptr_t) arg; @@ -602,13 +607,15 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco } return 0; } +/* }}} */ -ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC) +ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC) /* {{{ */ { return zval_update_constant_ex(pp, arg, NULL TSRMLS_CC); } +/* }}} */ -int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[] TSRMLS_DC) +int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[] TSRMLS_DC) /* {{{ */ { zval ***params_array; zend_uint i; @@ -634,9 +641,9 @@ int call_user_function(HashTable *function_table, zval **object_pp, zval *functi } return ex_retval; } +/* }}} */ - -int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, zend_uint param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC) +int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, zend_uint param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC) /* {{{ */ { zend_fcall_info fci; @@ -652,9 +659,9 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun return zend_call_function(&fci, NULL TSRMLS_CC); } +/* }}} */ - -int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TSRMLS_DC) +int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TSRMLS_DC) /* {{{ */ { zend_uint i; zval **original_return_value; @@ -1106,9 +1113,9 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS } return SUCCESS; } +/* }}} */ - -ZEND_API int zend_u_lookup_class_ex(zend_uchar type, zstr name, int name_length, int use_autoload, int do_normalize, zend_class_entry ***ce TSRMLS_DC) +ZEND_API int zend_u_lookup_class_ex(zend_uchar type, zstr name, int name_length, int use_autoload, int do_normalize, zend_class_entry ***ce TSRMLS_DC) /* {{{ */ { zval **args[1]; zval autoload_function; @@ -1226,23 +1233,27 @@ ZEND_API int zend_u_lookup_class_ex(zend_uchar type, zstr name, int name_length, } return retval; } +/* }}} */ -ZEND_API int zend_u_lookup_class(zend_uchar type, zstr name, int name_length, zend_class_entry ***ce TSRMLS_DC) +ZEND_API int zend_u_lookup_class(zend_uchar type, zstr name, int name_length, zend_class_entry ***ce TSRMLS_DC) /* {{{ */ { return zend_u_lookup_class_ex(type, name, name_length, 1, 1, ce TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_lookup_class_ex(char *name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC) +ZEND_API int zend_lookup_class_ex(char *name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC) /* {{{ */ { return zend_u_lookup_class_ex(IS_STRING, ZSTR(name), name_length, use_autoload, 1, ce TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC) +ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC) /* {{{ */ { return zend_u_lookup_class(IS_STRING, ZSTR(name), name_length, ce TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_u_eval_string(zend_uchar type, zstr string, zval *retval_ptr, char *string_name TSRMLS_DC) +ZEND_API int zend_u_eval_string(zend_uchar type, zstr string, zval *retval_ptr, char *string_name TSRMLS_DC) /* {{{ */ { zval pv; zend_op_array *new_op_array; @@ -1324,13 +1335,15 @@ ZEND_API int zend_u_eval_string(zend_uchar type, zstr string, zval *retval_ptr, zval_dtor(&pv); return retval; } +/* }}} */ -ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC) +ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC) /* {{{ */ { return zend_u_eval_string(IS_STRING, ZSTR(str), retval_ptr, string_name TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_u_eval_string_ex(zend_uchar type, zstr str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC) +ZEND_API int zend_u_eval_string_ex(zend_uchar type, zstr str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC) /* {{{ */ { int result; @@ -1341,14 +1354,15 @@ ZEND_API int zend_u_eval_string_ex(zend_uchar type, zstr str, zval *retval_ptr, } return result; } +/* }}} */ -ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC) +ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC) /* {{{ */ { return zend_u_eval_string_ex(IS_STRING, ZSTR(str), retval_ptr, string_name, handle_exceptions TSRMLS_CC); } +/* }}} */ - -void execute_new_code(TSRMLS_D) +void execute_new_code(TSRMLS_D) /* {{{ */ { zend_op *opline, *end; zend_op *ret_opline; @@ -1422,9 +1436,9 @@ void execute_new_code(TSRMLS_D) CG(active_op_array)->last -= 2; /* get rid of that ZEND_RETURN and ZEND_HANDLE_EXCEPTION */ CG(active_op_array)->start_op = CG(active_op_array)->opcodes+CG(active_op_array)->last; } +/* }}} */ - -ZEND_API void zend_timeout(int dummy) +ZEND_API void zend_timeout(int dummy) /* {{{ */ { TSRMLS_FETCH(); @@ -1435,9 +1449,10 @@ ZEND_API void zend_timeout(int dummy) zend_error(E_ERROR, "Maximum execution time of %d second%s exceeded", EG(timeout_seconds), EG(timeout_seconds) == 1 ? "" : "s"); } +/* }}} */ #ifdef ZEND_WIN32 -static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) /* {{{ */ { switch (message) { case WM_DESTROY: @@ -1485,10 +1500,9 @@ static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wPa } return 0; } +/* }}} */ - - -static unsigned __stdcall timeout_thread_proc(void *pArgs) +static unsigned __stdcall timeout_thread_proc(void *pArgs) /* {{{ */ { MSG message; @@ -1518,18 +1532,18 @@ static unsigned __stdcall timeout_thread_proc(void *pArgs) SetEvent(timeout_thread_handle); return 0; } +/* }}} */ - -void zend_init_timeout_thread() +void zend_init_timeout_thread() /* {{{ */ { timeout_thread_event = CreateEvent(NULL, FALSE, FALSE, NULL); timeout_thread_handle = CreateEvent(NULL, FALSE, FALSE, NULL); _beginthreadex(NULL, 0, timeout_thread_proc, NULL, 0, &timeout_thread_id); WaitForSingleObject(timeout_thread_event, INFINITE); } +/* }}} */ - -void zend_shutdown_timeout_thread() +void zend_shutdown_timeout_thread() /* {{{ */ { if (!timeout_thread_initialized) { return; @@ -1541,6 +1555,7 @@ void zend_shutdown_timeout_thread() CloseHandle(timeout_thread_handle); timeout_thread_initialized = 0; } +/* }}} */ #endif @@ -1549,7 +1564,7 @@ void zend_shutdown_timeout_thread() #define SIGPROF 27 #endif -void zend_set_timeout(long seconds) +void zend_set_timeout(long seconds) /* {{{ */ { TSRMLS_FETCH(); @@ -1590,9 +1605,9 @@ void zend_set_timeout(long seconds) # endif #endif } +/* }}} */ - -void zend_unset_timeout(TSRMLS_D) +void zend_unset_timeout(TSRMLS_D) /* {{{ */ { #ifdef ZEND_WIN32 if(timeout_thread_initialized) { @@ -1614,9 +1629,9 @@ void zend_unset_timeout(TSRMLS_D) # endif #endif } +/* }}} */ - -ZEND_API zend_class_entry *zend_u_fetch_class(zend_uchar type, zstr class_name, uint class_name_len, int fetch_type TSRMLS_DC) +ZEND_API zend_class_entry *zend_u_fetch_class(zend_uchar type, zstr class_name, uint class_name_len, int fetch_type TSRMLS_DC) /* {{{ */ { zend_class_entry **pce; int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) ? 0 : 1; @@ -1675,12 +1690,13 @@ check_fetch_type: return *pce; } } +/* }}} */ -zend_class_entry *zend_fetch_class(char *class_name, uint class_name_len, int fetch_type TSRMLS_DC) +zend_class_entry *zend_fetch_class(char *class_name, uint class_name_len, int fetch_type TSRMLS_DC) /* {{{ */ { return zend_u_fetch_class(IS_STRING, ZSTR(class_name), class_name_len, fetch_type TSRMLS_CC); } - +/* }}} */ #define MAX_ABSTRACT_INFO_CNT 3 #define MAX_ABSTRACT_INFO_FMT "%v%s%v%s" @@ -1695,8 +1711,7 @@ typedef struct _zend_abstract_info { int cnt; } zend_abstract_info; - -static int zend_verify_abstract_class_function(zend_function *fn, zend_abstract_info *ai TSRMLS_DC) +static int zend_verify_abstract_class_function(zend_function *fn, zend_abstract_info *ai TSRMLS_DC) /* {{{ */ { if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) { if (ai->cnt < MAX_ABSTRACT_INFO_CNT) { @@ -1706,9 +1721,9 @@ static int zend_verify_abstract_class_function(zend_function *fn, zend_abstract_ } return 0; } +/* }}} */ - -void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC) +void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC) /* {{{ */ { zend_abstract_info ai; @@ -1728,8 +1743,9 @@ void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC) } } } +/* }}} */ -ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC) +ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC) /* {{{ */ { zend_execute_data *ex; int i; @@ -1743,8 +1759,9 @@ ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC) } } } +/* }}} */ -ZEND_API int zend_u_delete_global_variable(zend_uchar type, zstr name, int name_len TSRMLS_DC) +ZEND_API int zend_u_delete_global_variable(zend_uchar type, zstr name, int name_len TSRMLS_DC) /* {{{ */ { zend_execute_data *ex; ulong hash_value = zend_u_inline_hash_func(type, name, name_len+1); @@ -1771,11 +1788,13 @@ ZEND_API int zend_u_delete_global_variable(zend_uchar type, zstr name, int name_ } return FAILURE; } +/* }}} */ -ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC) +ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC) /* {{{ */ { return zend_u_delete_global_variable(IS_STRING, ZSTR(name), name_len TSRMLS_CC); } +/* }}} */ /* * Local variables: diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c index ff3b6d8c1a..4f0e535e7b 100644 --- a/Zend/zend_extensions.c +++ b/Zend/zend_extensions.c @@ -24,7 +24,7 @@ ZEND_API zend_llist zend_extensions; static int last_resource_number; -int zend_load_extension(char *path) +int zend_load_extension(char *path) /* {{{ */ { #if ZEND_EXTENSIONS_SUPPORT DL_HANDLE handle; @@ -101,9 +101,9 @@ int zend_load_extension(char *path) return FAILURE; #endif } +/* }}} */ - -int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle) +int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle) /* {{{ */ { #if ZEND_EXTENSIONS_SUPPORT zend_extension extension; @@ -120,9 +120,9 @@ int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle) return SUCCESS; } +/* }}} */ - -static void zend_extension_shutdown(zend_extension *extension TSRMLS_DC) +static void zend_extension_shutdown(zend_extension *extension TSRMLS_DC) /* {{{ */ { #if ZEND_EXTENSIONS_SUPPORT if (extension->shutdown) { @@ -130,8 +130,9 @@ static void zend_extension_shutdown(zend_extension *extension TSRMLS_DC) } #endif } +/* }}} */ -static int zend_extension_startup(zend_extension *extension) +static int zend_extension_startup(zend_extension *extension) /* {{{ */ { #if ZEND_EXTENSIONS_SUPPORT if (extension->startup) { @@ -143,32 +144,32 @@ static int zend_extension_startup(zend_extension *extension) #endif return 0; } +/* }}} */ - -int zend_startup_extensions_mechanism() +int zend_startup_extensions_mechanism() /* {{{ */ { /* Startup extensions mechanism */ zend_llist_init(&zend_extensions, sizeof(zend_extension), (void (*)(void *)) zend_extension_dtor, 1); last_resource_number = 0; return SUCCESS; } +/* }}} */ - -int zend_startup_extensions() +int zend_startup_extensions() /* {{{ */ { zend_llist_apply_with_del(&zend_extensions, (int (*)(void *)) zend_extension_startup); return SUCCESS; } +/* }}} */ - -void zend_shutdown_extensions(TSRMLS_D) +void zend_shutdown_extensions(TSRMLS_D) /* {{{ */ { zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_shutdown TSRMLS_CC); zend_llist_destroy(&zend_extensions); } +/* }}} */ - -void zend_extension_dtor(zend_extension *extension) +void zend_extension_dtor(zend_extension *extension) /* {{{ */ { #if ZEND_EXTENSIONS_SUPPORT && !ZEND_DEBUG if (extension->handle) { @@ -176,9 +177,9 @@ void zend_extension_dtor(zend_extension *extension) } #endif } +/* }}} */ - -static void zend_extension_message_dispatcher(zend_extension *extension, int num_args, va_list args TSRMLS_DC) +static void zend_extension_message_dispatcher(zend_extension *extension, int num_args, va_list args TSRMLS_DC) /* {{{ */ { int message; void *arg; @@ -190,17 +191,17 @@ static void zend_extension_message_dispatcher(zend_extension *extension, int num arg = va_arg(args, void *); extension->message_handler(message, arg); } +/* }}} */ - -ZEND_API void zend_extension_dispatch_message(int message, void *arg) +ZEND_API void zend_extension_dispatch_message(int message, void *arg) /* {{{ */ { TSRMLS_FETCH(); zend_llist_apply_with_arguments(&zend_extensions, (llist_apply_with_args_func_t) zend_extension_message_dispatcher TSRMLS_CC, 2, message, arg); } +/* }}} */ - -ZEND_API int zend_get_resource_handle(zend_extension *extension) +ZEND_API int zend_get_resource_handle(zend_extension *extension) /* {{{ */ { if (last_resource_numberresource_number = last_resource_number; @@ -209,9 +210,9 @@ ZEND_API int zend_get_resource_handle(zend_extension *extension) return -1; } } +/* }}} */ - -ZEND_API zend_extension *zend_get_extension(char *extension_name) +ZEND_API zend_extension *zend_get_extension(char *extension_name) /* {{{ */ { zend_llist_element *element; @@ -224,6 +225,7 @@ ZEND_API zend_extension *zend_get_extension(char *extension_name) } return NULL; } +/* }}} */ /* * Support for dynamic loading of MH_BUNDLEs on Darwin / Mac OS X @@ -232,7 +234,7 @@ ZEND_API zend_extension *zend_get_extension(char *extension_name) #if HAVE_MACH_O_DYLD_H -void *zend_mh_bundle_load(char* bundle_path) +void *zend_mh_bundle_load(char* bundle_path) /* {{{ */ { NSObjectFileImage bundle_image; NSModule bundle_handle; @@ -255,8 +257,9 @@ void *zend_mh_bundle_load(char* bundle_path) return bundle_handle; } +/* }}} */ -int zend_mh_bundle_unload(void *bundle_handle) +int zend_mh_bundle_unload(void *bundle_handle) /* {{{ */ { NSSymbol bundle_fini_nssymbol; void (*bundle_fini)(void); @@ -270,19 +273,22 @@ int zend_mh_bundle_unload(void *bundle_handle) return (int) NSUnLinkModule(bundle_handle, NULL); } +/* }}} */ -void *zend_mh_bundle_symbol(void *bundle_handle, const char *symbol_name) +void *zend_mh_bundle_symbol(void *bundle_handle, const char *symbol_name) /* {{{ */ { NSSymbol symbol; symbol = NSLookupSymbolInModule(bundle_handle, symbol_name); return NSAddressOfSymbol(symbol); } +/* }}} */ -const char *zend_mh_bundle_error(void) +const char *zend_mh_bundle_error(void) /* {{{ */ { /* Witness the state of the art error reporting */ return NULL; } +/* }}} */ #endif /* HAVE_MACH_O_DYLD_H */ diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index e313aaf0cd..f17efbb4f4 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -72,7 +72,7 @@ #define HT_DESTROYED 2 #define HT_CLEANING 3 -static void _zend_is_inconsistent(HashTable *ht, char *file, int line) +static void _zend_is_inconsistent(HashTable *ht, char *file, int line) /* {{{ */ { if (ht->inconsistent==HT_OK) { return; @@ -90,6 +90,8 @@ static void _zend_is_inconsistent(HashTable *ht, char *file, int line) } zend_bailout(); } +/* }}} */ + #define IS_CONSISTENT(a) _zend_is_inconsistent(a, __FILE__, __LINE__); #define SET_INCONSISTENT(n) ht->inconsistent = n; #else @@ -118,15 +120,17 @@ static void _zend_is_inconsistent(HashTable *ht, char *file, int line) static int zend_hash_do_resize(HashTable *ht); -ZEND_API ulong zend_u_hash_func(zend_uchar type, zstr arKey, uint nKeyLength) +ZEND_API ulong zend_u_hash_func(zend_uchar type, zstr arKey, uint nKeyLength) /* {{{ */ { return zend_u_inline_hash_func(type, arKey, nKeyLength); } +/* }}} */ -ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength) +ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength) /* {{{ */ { return zend_u_hash_func(IS_STRING, ZSTR(arKey), nKeyLength); } +/* }}} */ #define UPDATE_DATA(ht, p, pData, nDataSize) \ if (nDataSize == sizeof(void*)) { \ @@ -156,10 +160,9 @@ ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength) } \ memcpy((p)->pData, pData, nDataSize); \ } +/* }}} */ - - -ZEND_API int _zend_u_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool unicode ZEND_FILE_LINE_DC) +ZEND_API int _zend_u_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool unicode ZEND_FILE_LINE_DC) /* {{{ */ { uint i = 3; Bucket **tmp; @@ -205,36 +208,39 @@ ZEND_API int _zend_u_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunct return SUCCESS; } +/* }}} */ -ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC) +ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC) /* {{{ */ { return _zend_u_hash_init(ht, nSize, pHashFunction, pDestructor, persistent, 0 ZEND_FILE_LINE_CC); } +/* }}} */ -ZEND_API int _zend_hash_init_ex(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC) +ZEND_API int _zend_hash_init_ex(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC) /* {{{ */ { int retval = _zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent ZEND_FILE_LINE_CC); ht->bApplyProtection = bApplyProtection; return retval; } +/* }}} */ -ZEND_API int _zend_u_hash_init_ex(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool unicode, zend_bool bApplyProtection ZEND_FILE_LINE_DC) +ZEND_API int _zend_u_hash_init_ex(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool unicode, zend_bool bApplyProtection ZEND_FILE_LINE_DC) /* {{{ */ { int retval = _zend_u_hash_init(ht, nSize, pHashFunction, pDestructor, persistent, unicode ZEND_FILE_LINE_CC); ht->bApplyProtection = bApplyProtection; return retval; } +/* }}} */ -ZEND_API void zend_hash_set_apply_protection(HashTable *ht, zend_bool bApplyProtection) +ZEND_API void zend_hash_set_apply_protection(HashTable *ht, zend_bool bApplyProtection) /* {{{ */ { ht->bApplyProtection = bApplyProtection; } +/* }}} */ - - -ZEND_API int _zend_u_hash_add_or_update(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) +ZEND_API int _zend_u_hash_add_or_update(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) /* {{{ */ { ulong h; uint nIndex; @@ -315,13 +321,15 @@ ZEND_API int _zend_u_hash_add_or_update(HashTable *ht, zend_uchar type, zstr arK if (tmp) efree(tmp); return SUCCESS; } +/* }}} */ -ZEND_API int _zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) +ZEND_API int _zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) /* {{{ */ { return _zend_u_hash_add_or_update(ht, IS_STRING, ZSTR(arKey), nKeyLength, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); } +/* }}} */ -ZEND_API int _zend_ascii_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) +ZEND_API int _zend_ascii_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) /* {{{ */ { TSRMLS_FETCH(); @@ -337,8 +345,9 @@ ZEND_API int _zend_ascii_hash_add_or_update(HashTable *ht, char *arKey, uint nKe return _zend_u_hash_add_or_update(ht, IS_STRING, ZSTR(arKey), nKeyLength, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); } } +/* }}} */ -ZEND_API int _zend_rt_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) +ZEND_API int _zend_rt_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) /* {{{ */ { TSRMLS_FETCH(); @@ -362,8 +371,9 @@ string_key: return _zend_u_hash_add_or_update(ht, IS_STRING, ZSTR(arKey), nKeyLength, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); } } +/* }}} */ -ZEND_API int _zend_utf8_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) +ZEND_API int _zend_utf8_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) /* {{{ */ { TSRMLS_FETCH(); @@ -387,8 +397,9 @@ string_key: return _zend_u_hash_add_or_update(ht, IS_STRING, ZSTR(arKey), nKeyLength, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); } } +/* }}} */ -ZEND_API int _zend_u_hash_quick_add_or_update(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) +ZEND_API int _zend_u_hash_quick_add_or_update(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) /* {{{ */ { uint nIndex; Bucket *p; @@ -470,28 +481,31 @@ ZEND_API int _zend_u_hash_quick_add_or_update(HashTable *ht, zend_uchar type, zs if (tmp) efree(tmp); return SUCCESS; } +/* }}} */ -ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) +ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) /* {{{ */ { return _zend_u_hash_quick_add_or_update(ht, IS_STRING, ZSTR(arKey), nKeyLength, h, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); } +/* }}} */ -ZEND_API int zend_u_hash_add_empty_element(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength) +ZEND_API int zend_u_hash_add_empty_element(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength) /* {{{ */ { void *dummy = (void *) 1; return zend_u_hash_add(ht, type, arKey, nKeyLength, &dummy, sizeof(void *), NULL); } +/* }}} */ -ZEND_API int zend_hash_add_empty_element(HashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_hash_add_empty_element(HashTable *ht, char *arKey, uint nKeyLength) /* {{{ */ { void *dummy = (void *) 1; return zend_u_hash_add(ht, IS_STRING, ZSTR(arKey), nKeyLength, &dummy, sizeof(void *), NULL); } +/* }}} */ - -ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) +ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) /* {{{ */ { uint nIndex; Bucket *p; @@ -559,9 +573,9 @@ ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void ZEND_HASH_IF_FULL_DO_RESIZE(ht); return SUCCESS; } +/* }}} */ - -static int zend_hash_do_resize(HashTable *ht) +static int zend_hash_do_resize(HashTable *ht) /* {{{ */ { Bucket **t; @@ -582,8 +596,9 @@ static int zend_hash_do_resize(HashTable *ht) } return SUCCESS; } +/* }}} */ -ZEND_API int zend_hash_rehash(HashTable *ht) +ZEND_API int zend_hash_rehash(HashTable *ht) /* {{{ */ { Bucket *p; uint nIndex; @@ -600,8 +615,9 @@ ZEND_API int zend_hash_rehash(HashTable *ht) } return SUCCESS; } +/* }}} */ -ZEND_API int zend_u_hash_del_key_or_index(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h, int flag) +ZEND_API int zend_u_hash_del_key_or_index(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h, int flag) /* {{{ */ { uint nIndex; Bucket *p; @@ -664,13 +680,15 @@ ZEND_API int zend_u_hash_del_key_or_index(HashTable *ht, zend_uchar type, zstr a if (tmp) efree(tmp); return FAILURE; } +/* }}} */ -ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag) +ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag) /* {{{ */ { return zend_u_hash_del_key_or_index(ht, IS_STRING, ZSTR(arKey), nKeyLength, h, flag); } +/* }}} */ -ZEND_API int zend_ascii_hash_del(HashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_ascii_hash_del(HashTable *ht, char *arKey, uint nKeyLength) /* {{{ */ { TSRMLS_FETCH(); @@ -686,8 +704,9 @@ ZEND_API int zend_ascii_hash_del(HashTable *ht, char *arKey, uint nKeyLength) return zend_u_hash_del_key_or_index(ht, IS_STRING, ZSTR(arKey), nKeyLength, 0, HASH_DEL_KEY); } } +/* }}} */ -ZEND_API int zend_rt_hash_del(HashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_rt_hash_del(HashTable *ht, char *arKey, uint nKeyLength) /* {{{ */ { TSRMLS_FETCH(); @@ -710,8 +729,9 @@ string_key: return zend_u_hash_del_key_or_index(ht, IS_STRING, ZSTR(arKey), nKeyLength, 0, HASH_DEL_KEY); } } +/* }}} */ -ZEND_API int zend_utf8_hash_del(HashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_utf8_hash_del(HashTable *ht, char *arKey, uint nKeyLength) /* {{{ */ { TSRMLS_FETCH(); @@ -734,8 +754,9 @@ string_key: return zend_u_hash_del_key_or_index(ht, IS_STRING, ZSTR(arKey), nKeyLength, 0, HASH_DEL_KEY); } } +/* }}} */ -ZEND_API void zend_hash_destroy(HashTable *ht) +ZEND_API void zend_hash_destroy(HashTable *ht) /* {{{ */ { Bucket *p, *q; @@ -759,9 +780,9 @@ ZEND_API void zend_hash_destroy(HashTable *ht) SET_INCONSISTENT(HT_DESTROYED); } +/* }}} */ - -ZEND_API void zend_hash_clean(HashTable *ht) +ZEND_API void zend_hash_clean(HashTable *ht) /* {{{ */ { Bucket *p, *q; @@ -790,13 +811,14 @@ ZEND_API void zend_hash_clean(HashTable *ht) SET_INCONSISTENT(HT_OK); } +/* }}} */ /* This function is used by the various apply() functions. * It deletes the passed bucket, and returns the address of the * next bucket. The hash *may* be altered during that time, the * returned value will still be valid. */ -static Bucket *zend_hash_apply_deleter(HashTable *ht, Bucket *p) +static Bucket *zend_hash_apply_deleter(HashTable *ht, Bucket *p) /* {{{ */ { Bucket *retval; @@ -843,9 +865,9 @@ static Bucket *zend_hash_apply_deleter(HashTable *ht, Bucket *p) return retval; } +/* }}} */ - -ZEND_API void zend_hash_graceful_destroy(HashTable *ht) +ZEND_API void zend_hash_graceful_destroy(HashTable *ht) /* {{{ */ { Bucket *p; @@ -859,8 +881,9 @@ ZEND_API void zend_hash_graceful_destroy(HashTable *ht) SET_INCONSISTENT(HT_DESTROYED); } +/* }}} */ -ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht) +ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht) /* {{{ */ { Bucket *p; @@ -876,6 +899,7 @@ ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht) SET_INCONSISTENT(HT_DESTROYED); } +/* }}} */ /* This is used to recurse elements and selectively delete certain entries * from a hashtable. apply_func() receives the data and decides if the entry @@ -886,7 +910,7 @@ ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht) * ZEND_HASH_APPLY_REMOVE - delete the element, combineable with the former */ -ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC) +ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC) /* {{{ */ { Bucket *p; @@ -908,9 +932,9 @@ ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC) } HASH_UNPROTECT_RECURSION(ht); } +/* }}} */ - -ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void *argument TSRMLS_DC) +ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void *argument TSRMLS_DC) /* {{{ */ { Bucket *p; @@ -932,9 +956,9 @@ ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t appl } HASH_UNPROTECT_RECURSION(ht); } +/* }}} */ - -ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t apply_func, int num_args, ...) +ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t apply_func, int num_args, ...) /* {{{ */ { Bucket *p; va_list args; @@ -967,9 +991,9 @@ ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t ap HASH_UNPROTECT_RECURSION(ht); } +/* }}} */ - -ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC) +ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC) /* {{{ */ { Bucket *p, *q; @@ -995,9 +1019,9 @@ ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSR } HASH_UNPROTECT_RECURSION(ht); } +/* }}} */ - -ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size) +ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size) /* {{{ */ { Bucket *p; void *new_entry; @@ -1019,9 +1043,9 @@ ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_fun } target->pInternalPointer = target->pListHead; } +/* }}} */ - -ZEND_API void _zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite ZEND_FILE_LINE_DC) +ZEND_API void _zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite ZEND_FILE_LINE_DC) /* {{{ */ { Bucket *p; void *t; @@ -1045,9 +1069,9 @@ ZEND_API void _zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_f } target->pInternalPointer = target->pListHead; } +/* }}} */ - -static zend_bool zend_hash_replace_checker_wrapper(HashTable *target, void *source_data, Bucket *p, void *pParam, merge_checker_func_t merge_checker_func) +static zend_bool zend_hash_replace_checker_wrapper(HashTable *target, void *source_data, Bucket *p, void *pParam, merge_checker_func_t merge_checker_func) /* {{{ */ { zend_hash_key hash_key; @@ -1057,9 +1081,9 @@ static zend_bool zend_hash_replace_checker_wrapper(HashTable *target, void *sour hash_key.arKey.s = p->key.arKey.s; return merge_checker_func(target, source_data, &hash_key, pParam); } +/* }}} */ - -ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, uint size, merge_checker_func_t pMergeSource, void *pParam) +ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, uint size, merge_checker_func_t pMergeSource, void *pParam) /* {{{ */ { Bucket *p; void *t; @@ -1078,24 +1102,25 @@ ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor } target->pInternalPointer = target->pListHead; } +/* }}} */ - -ZEND_API ulong zend_u_get_hash_value(zend_uchar type, zstr arKey, uint nKeyLength) +ZEND_API ulong zend_u_get_hash_value(zend_uchar type, zstr arKey, uint nKeyLength) /* {{{ */ { return zend_u_inline_hash_func(type, arKey, nKeyLength); } +/* }}} */ -ZEND_API ulong zend_get_hash_value(char *arKey, uint nKeyLength) +ZEND_API ulong zend_get_hash_value(char *arKey, uint nKeyLength) /* {{{ */ { return zend_u_get_hash_value(IS_STRING, ZSTR(arKey), nKeyLength); } - +/* }}} */ /* Returns SUCCESS if found and FAILURE if not. The pointer to the * data is returned in pData. The reason is that there's no reason * someone using the hash table might not want to have NULL data */ -ZEND_API int zend_u_hash_find(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void **pData) +ZEND_API int zend_u_hash_find(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void **pData) /* {{{ */ { ulong h; uint nIndex; @@ -1126,13 +1151,15 @@ ZEND_API int zend_u_hash_find(HashTable *ht, zend_uchar type, zstr arKey, uint n if (tmp) efree(tmp); return FAILURE; } +/* }}} */ -ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) +ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) /* {{{ */ { return zend_u_hash_find(ht, IS_STRING, ZSTR(arKey), nKeyLength, pData); } +/* }}} */ -ZEND_API int zend_ascii_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) +ZEND_API int zend_ascii_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) /* {{{ */ { TSRMLS_FETCH(); @@ -1148,8 +1175,9 @@ ZEND_API int zend_ascii_hash_find(HashTable *ht, char *arKey, uint nKeyLength, v return zend_u_hash_find(ht, IS_STRING, ZSTR(arKey), nKeyLength, pData); } } +/* }}} */ -ZEND_API int zend_rt_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) +ZEND_API int zend_rt_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) /* {{{ */ { TSRMLS_FETCH(); @@ -1172,8 +1200,9 @@ string_key: return zend_u_hash_find(ht, IS_STRING, ZSTR(arKey), nKeyLength, pData); } } +/* }}} */ -ZEND_API int zend_utf8_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) +ZEND_API int zend_utf8_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) /* {{{ */ { TSRMLS_FETCH(); @@ -1196,8 +1225,9 @@ string_key: return zend_u_hash_find(ht, IS_STRING, ZSTR(arKey), nKeyLength, pData); } } +/* }}} */ -ZEND_API int zend_u_hash_quick_find(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h, void **pData) +ZEND_API int zend_u_hash_quick_find(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h, void **pData) /* {{{ */ { uint nIndex; Bucket *p; @@ -1233,13 +1263,15 @@ ZEND_API int zend_u_hash_quick_find(HashTable *ht, zend_uchar type, zstr arKey, if (tmp) efree(tmp); return FAILURE; } +/* }}} */ -ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData) +ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData) /* {{{ */ { return zend_u_hash_quick_find(ht, IS_STRING, ZSTR(arKey), nKeyLength, h, pData); } +/* }}} */ -ZEND_API int zend_u_hash_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength) +ZEND_API int zend_u_hash_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength) /* {{{ */ { ulong h; uint nIndex; @@ -1269,13 +1301,15 @@ ZEND_API int zend_u_hash_exists(HashTable *ht, zend_uchar type, zstr arKey, uint if (tmp) efree(tmp); return 0; } +/* }}} */ -ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength) /* {{{ */ { return zend_u_hash_exists(ht, IS_STRING, ZSTR(arKey), nKeyLength); } +/* }}} */ -ZEND_API int zend_ascii_hash_exists(HashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_ascii_hash_exists(HashTable *ht, char *arKey, uint nKeyLength) /* {{{ */ { TSRMLS_FETCH(); @@ -1291,8 +1325,9 @@ ZEND_API int zend_ascii_hash_exists(HashTable *ht, char *arKey, uint nKeyLength) return zend_u_hash_exists(ht, IS_STRING, ZSTR(arKey), nKeyLength); } } +/* }}} */ -ZEND_API int zend_rt_hash_exists(HashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_rt_hash_exists(HashTable *ht, char *arKey, uint nKeyLength) /* {{{ */ { TSRMLS_FETCH(); @@ -1315,8 +1350,9 @@ string_key: return zend_u_hash_exists(ht, IS_STRING, ZSTR(arKey), nKeyLength); } } +/* }}} */ -ZEND_API int zend_utf8_hash_exists(HashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_utf8_hash_exists(HashTable *ht, char *arKey, uint nKeyLength) /* {{{ */ { TSRMLS_FETCH(); @@ -1339,8 +1375,9 @@ string_key: return zend_u_hash_exists(ht, IS_STRING, ZSTR(arKey), nKeyLength); } } +/* }}} */ -ZEND_API int zend_u_hash_quick_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h) +ZEND_API int zend_u_hash_quick_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h) /* {{{ */ { uint nIndex; Bucket *p; @@ -1375,13 +1412,15 @@ ZEND_API int zend_u_hash_quick_exists(HashTable *ht, zend_uchar type, zstr arKey if (tmp) efree(tmp); return 0; } +/* }}} */ -ZEND_API int zend_hash_quick_exists(HashTable *ht, char *arKey, uint nKeyLength, ulong h) +ZEND_API int zend_hash_quick_exists(HashTable *ht, char *arKey, uint nKeyLength, ulong h) /* {{{ */ { return zend_u_hash_quick_exists(ht, IS_STRING, ZSTR(arKey), nKeyLength, h); } +/* }}} */ -ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData) +ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData) /* {{{ */ { uint nIndex; Bucket *p; @@ -1400,9 +1439,9 @@ ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData) } return FAILURE; } +/* }}} */ - -ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h) +ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h) /* {{{ */ { uint nIndex; Bucket *p; @@ -1420,17 +1459,17 @@ ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h) } return 0; } +/* }}} */ - -ZEND_API int zend_hash_num_elements(HashTable *ht) +ZEND_API int zend_hash_num_elements(HashTable *ht) /* {{{ */ { IS_CONSISTENT(ht); return ht->nNumOfElements; } +/* }}} */ - -ZEND_API int zend_hash_get_pointer(HashTable *ht, HashPointer *ptr) +ZEND_API int zend_hash_get_pointer(HashTable *ht, HashPointer *ptr) /* {{{ */ { ptr->pos = ht->pInternalPointer; if (ht->pInternalPointer) { @@ -1441,8 +1480,9 @@ ZEND_API int zend_hash_get_pointer(HashTable *ht, HashPointer *ptr) return 0; } } +/* }}} */ -ZEND_API int zend_hash_set_pointer(HashTable *ht, const HashPointer *ptr) +ZEND_API int zend_hash_set_pointer(HashTable *ht, const HashPointer *ptr) /* {{{ */ { if (ptr->pos == NULL) { ht->pInternalPointer = NULL; @@ -1462,8 +1502,9 @@ ZEND_API int zend_hash_set_pointer(HashTable *ht, const HashPointer *ptr) } return 1; } +/* }}} */ -ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos) +ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos) /* {{{ */ { IS_CONSISTENT(ht); @@ -1472,12 +1513,12 @@ ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *p else ht->pInternalPointer = ht->pListHead; } - +/* }}} */ /* This function will be extremely optimized by remembering * the end of the list */ -ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos) +ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos) /* {{{ */ { IS_CONSISTENT(ht); @@ -1486,9 +1527,9 @@ ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos else ht->pInternalPointer = ht->pListTail; } +/* }}} */ - -ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos) +ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos) /* {{{ */ { HashPosition *current = pos ? pos : &ht->pInternalPointer; @@ -1500,8 +1541,9 @@ ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos) } else return FAILURE; } +/* }}} */ -ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos) +ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos) /* {{{ */ { HashPosition *current = pos ? pos : &ht->pInternalPointer; @@ -1513,10 +1555,10 @@ ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos) } else return FAILURE; } - +/* }}} */ /* This function should be made binary safe */ -ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, zstr *str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos) +ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, zstr *str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos) /* {{{ */ { Bucket *p; @@ -1554,9 +1596,9 @@ ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, zstr *str_index, uint * } return HASH_KEY_NON_EXISTANT; } +/* }}} */ - -ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos) +ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos) /* {{{ */ { Bucket *p; @@ -1577,9 +1619,9 @@ ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos) } return HASH_KEY_NON_EXISTANT; } +/* }}} */ - -ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos) +ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos) /* {{{ */ { Bucket *p; @@ -1594,11 +1636,12 @@ ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosi return FAILURE; } } +/* }}} */ /* This function changes key of currevt element without changing elements' * order. If element with target key already exists, it will be deleted first. */ -ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, zstr str_index, uint str_length, ulong num_index, HashPosition *pos) +ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, zstr str_index, uint str_length, ulong num_index, HashPosition *pos) /* {{{ */ { Bucket *p; uint real_length; @@ -1698,9 +1741,9 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, zstr s return FAILURE; } } +/* }}} */ -ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, - compare_func_t compar, int renumber TSRMLS_DC) +ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, compare_func_t compar, int renumber TSRMLS_DC) /* {{{ */ { Bucket **arTmp; Bucket *p; @@ -1760,9 +1803,9 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, } return SUCCESS; } +/* }}} */ - -ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC) +ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC) /* {{{ */ { Bucket *p1, *p2 = NULL; int result; @@ -1846,9 +1889,9 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t co HASH_UNPROTECT_RECURSION(ht2); return 0; } +/* }}} */ - -ZEND_API int zend_hash_minmax(HashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC) +ZEND_API int zend_hash_minmax(HashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC) /* {{{ */ { Bucket *p, *res; @@ -1874,15 +1917,18 @@ ZEND_API int zend_hash_minmax(HashTable *ht, compare_func_t compar, int flag, vo *pData = res->pData; return SUCCESS; } +/* }}} */ -ZEND_API ulong zend_hash_next_free_element(HashTable *ht) +ZEND_API ulong zend_hash_next_free_element(HashTable *ht) /* {{{ */ { IS_CONSISTENT(ht); return ht->nNextFreeElement; } +/* }}} */ +/* {{{ HANDLE_*_NUMERIC macros */ #define HANDLE_NUMERIC(key, length, func) { \ register char *tmp=key; \ \ @@ -1952,8 +1998,9 @@ ZEND_API ulong zend_hash_next_free_element(HashTable *ht) } \ } while (0); \ } +/* }}} */ -ZEND_API int zend_u_symtable_update(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest) +ZEND_API int zend_u_symtable_update(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest) /* {{{ */ { if (type == IS_STRING) { HANDLE_NUMERIC(arKey.s, nKeyLength, zend_hash_index_update(ht, idx, pData, nDataSize, pDest)); @@ -1962,9 +2009,9 @@ ZEND_API int zend_u_symtable_update(HashTable *ht, zend_uchar type, zstr arKey, } return zend_u_hash_update(ht, type, arKey, nKeyLength, pData, nDataSize, pDest); } +/* }}} */ - -ZEND_API int zend_u_symtable_del(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength) +ZEND_API int zend_u_symtable_del(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength) /* {{{ */ { if (type == IS_STRING) { HANDLE_NUMERIC(arKey.s, nKeyLength, zend_hash_index_del(ht, idx)); @@ -1973,9 +2020,9 @@ ZEND_API int zend_u_symtable_del(HashTable *ht, zend_uchar type, zstr arKey, uin } return zend_u_hash_del(ht, type, arKey, nKeyLength); } +/* }}} */ - -ZEND_API int zend_u_symtable_find(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void **pData) +ZEND_API int zend_u_symtable_find(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void **pData) /* {{{ */ { if (type == IS_STRING) { HANDLE_NUMERIC(arKey.s, nKeyLength, zend_hash_index_find(ht, idx, pData)); @@ -1984,9 +2031,9 @@ ZEND_API int zend_u_symtable_find(HashTable *ht, zend_uchar type, zstr arKey, ui } return zend_u_hash_find(ht, type, arKey, nKeyLength, pData); } +/* }}} */ - -ZEND_API int zend_u_symtable_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength) +ZEND_API int zend_u_symtable_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength) /* {{{ */ { if (type == IS_STRING) { HANDLE_NUMERIC(arKey.s, nKeyLength, zend_hash_index_exists(ht, idx)); @@ -1995,9 +2042,9 @@ ZEND_API int zend_u_symtable_exists(HashTable *ht, zend_uchar type, zstr arKey, } return zend_u_hash_exists(ht, type, arKey, nKeyLength); } +/* }}} */ - -ZEND_API int zend_u_symtable_update_current_key(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength) +ZEND_API int zend_u_symtable_update_current_key(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength) /* {{{ */ { zend_uchar key_type; @@ -2010,124 +2057,128 @@ ZEND_API int zend_u_symtable_update_current_key(HashTable *ht, zend_uchar type, } return zend_hash_update_current_key(ht, key_type, arKey, nKeyLength, 0); } +/* }}} */ - -ZEND_API int zend_symtable_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest) +ZEND_API int zend_symtable_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest) /* {{{ */ { HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_update(ht, idx, pData, nDataSize, pDest)); return zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest); } +/* }}} */ - -ZEND_API int zend_symtable_del(HashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_symtable_del(HashTable *ht, char *arKey, uint nKeyLength) /* {{{ */ { HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_del(ht, idx)) return zend_hash_del(ht, arKey, nKeyLength); } +/* }}} */ - -ZEND_API int zend_symtable_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) +ZEND_API int zend_symtable_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) /* {{{ */ { HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_find(ht, idx, pData)); return zend_hash_find(ht, arKey, nKeyLength, pData); } +/* }}} */ - -ZEND_API int zend_symtable_exists(HashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_symtable_exists(HashTable *ht, char *arKey, uint nKeyLength) /* {{{ */ { HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_exists(ht, idx)); return zend_hash_exists(ht, arKey, nKeyLength); } +/* }}} */ - -ZEND_API int zend_symtable_update_current_key(HashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_symtable_update_current_key(HashTable *ht, char *arKey, uint nKeyLength) /* {{{ */ { HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, NULL_ZSTR, 0, idx)); return zend_hash_update_current_key(ht, HASH_KEY_IS_STRING, ZSTR(arKey), nKeyLength, 0); } +/* }}} */ -ZEND_API int zend_ascii_symtable_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest) +ZEND_API int zend_ascii_symtable_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest) /* {{{ */ { HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_update(ht, idx, pData, nDataSize, pDest)); return zend_ascii_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest); } +/* }}} */ - -ZEND_API int zend_ascii_symtable_del(HashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_ascii_symtable_del(HashTable *ht, char *arKey, uint nKeyLength) /* {{{ */ { HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_del(ht, idx)) return zend_ascii_hash_del(ht, arKey, nKeyLength); } +/* }}} */ - -ZEND_API int zend_ascii_symtable_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) +ZEND_API int zend_ascii_symtable_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) /* {{{ */ { HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_find(ht, idx, pData)); return zend_ascii_hash_find(ht, arKey, nKeyLength, pData); } +/* }}} */ - -ZEND_API int zend_ascii_symtable_exists(HashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_ascii_symtable_exists(HashTable *ht, char *arKey, uint nKeyLength) /* {{{ */ { HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_exists(ht, idx)); return zend_ascii_hash_exists(ht, arKey, nKeyLength); } +/* }}} */ -ZEND_API int zend_rt_symtable_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest) +ZEND_API int zend_rt_symtable_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest) /* {{{ */ { HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_update(ht, idx, pData, nDataSize, pDest)); return zend_rt_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest); } +/* }}} */ - -ZEND_API int zend_rt_symtable_del(HashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_rt_symtable_del(HashTable *ht, char *arKey, uint nKeyLength) /* {{{ */ { HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_del(ht, idx)) return zend_rt_hash_del(ht, arKey, nKeyLength); } +/* }}} */ - -ZEND_API int zend_rt_symtable_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) +ZEND_API int zend_rt_symtable_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) /* {{{ */ { HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_find(ht, idx, pData)); return zend_rt_hash_find(ht, arKey, nKeyLength, pData); } +/* }}} */ - -ZEND_API int zend_rt_symtable_exists(HashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_rt_symtable_exists(HashTable *ht, char *arKey, uint nKeyLength) /* {{{ */ { HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_exists(ht, idx)); return zend_rt_hash_exists(ht, arKey, nKeyLength); } +/* }}} */ -ZEND_API int zend_utf8_symtable_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest) +ZEND_API int zend_utf8_symtable_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest) /* {{{ */ { HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_update(ht, idx, pData, nDataSize, pDest)); return zend_utf8_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest); } +/* }}} */ - -ZEND_API int zend_utf8_symtable_del(HashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_utf8_symtable_del(HashTable *ht, char *arKey, uint nKeyLength) /* {{{ */ { HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_del(ht, idx)) return zend_utf8_hash_del(ht, arKey, nKeyLength); } +/* }}} */ - -ZEND_API int zend_utf8_symtable_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) +ZEND_API int zend_utf8_symtable_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) /* {{{ */ { HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_find(ht, idx, pData)); return zend_utf8_hash_find(ht, arKey, nKeyLength, pData); } +/* }}} */ - -ZEND_API int zend_utf8_symtable_exists(HashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_utf8_symtable_exists(HashTable *ht, char *arKey, uint nKeyLength) /* {{{ */ { HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_exists(ht, idx)); return zend_utf8_hash_exists(ht, arKey, nKeyLength); } +/* }}} */ -ZEND_API void zend_hash_to_unicode(HashTable *ht, apply_func_t apply_func TSRMLS_DC) +ZEND_API void zend_hash_to_unicode(HashTable *ht, apply_func_t apply_func TSRMLS_DC) /* {{{ */ { Bucket **p; uint nIndex; @@ -2179,9 +2230,10 @@ ZEND_API void zend_hash_to_unicode(HashTable *ht, apply_func_t apply_func TSRMLS p = &(*p)->pListNext; } } +/* }}} */ #if ZEND_DEBUG -void zend_hash_display_pListTail(HashTable *ht) +void zend_hash_display_pListTail(HashTable *ht) /* {{{ */ { Bucket *p; @@ -2195,8 +2247,9 @@ void zend_hash_display_pListTail(HashTable *ht) p = p->pListLast; } } +/* }}} */ -void zend_hash_display(HashTable *ht) +void zend_hash_display(HashTable *ht) /* {{{ */ { Bucket *p; uint i; @@ -2223,6 +2276,7 @@ void zend_hash_display(HashTable *ht) p = p->pListLast; } } +/* }}} */ #endif diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c index 2087a19b2a..07445f1fc8 100644 --- a/Zend/zend_highlight.c +++ b/Zend/zend_highlight.c @@ -27,7 +27,7 @@ #include "zend_globals.h" #include "zend_operators.h" -ZEND_API void zend_html_putc(char c) +ZEND_API void zend_html_putc(char c) /* {{{ */ { switch (c) { case '\n': @@ -53,9 +53,9 @@ ZEND_API void zend_html_putc(char c) break; } } +/* }}} */ - -ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC) +ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC) /* {{{ */ { const char *ptr=s, *end=s+len; @@ -69,10 +69,9 @@ ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC) } } } +/* }}} */ - - -ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC) +ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC) /* {{{ */ { zval token; int token_type; @@ -167,10 +166,9 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini zend_printf("\n"); zend_printf(""); } +/* }}} */ - - -ZEND_API void zend_strip(TSRMLS_D) +ZEND_API void zend_strip(TSRMLS_D) /* {{{ */ { zval token; int token_type; @@ -230,6 +228,7 @@ ZEND_API void zend_strip(TSRMLS_D) prev_space = Z_TYPE(token) = 0; } } +/* }}} */ /* * Local variables: diff --git a/Zend/zend_indent.c b/Zend/zend_indent.c index 70c19461ce..5e1ad1e0e2 100644 --- a/Zend/zend_indent.c +++ b/Zend/zend_indent.c @@ -30,8 +30,7 @@ #define zendtext LANG_SCNG(yy_text) #define zendleng LANG_SCNG(yy_leng) - -static void handle_whitespace(int *emit_whitespace) +static void handle_whitespace(int *emit_whitespace) /* {{{ */ { unsigned char c; int i; @@ -45,9 +44,9 @@ static void handle_whitespace(int *emit_whitespace) } memset(emit_whitespace, 0, sizeof(int)*256); } +/* }}} */ - -ZEND_API void zend_indent() +ZEND_API void zend_indent() /* {{{ */ { zval token; int token_type; @@ -146,6 +145,7 @@ dflt_printout: Z_TYPE(token) = 0; } } +/* }}} */ /* * Local variables: diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 57845d3789..fc8d034992 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -34,7 +34,7 @@ static HashTable *registered_zend_ini_directives; /* * hash_apply functions */ -static int zend_remove_ini_entries(zend_ini_entry *ini_entry, int *module_number TSRMLS_DC) +static int zend_remove_ini_entries(zend_ini_entry *ini_entry, int *module_number TSRMLS_DC) /* {{{ */ { if (ini_entry->module_number == *module_number) { return 1; @@ -42,9 +42,9 @@ static int zend_remove_ini_entries(zend_ini_entry *ini_entry, int *module_number return 0; } } +/* }}} */ - -static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS_DC) +static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS_DC) /* {{{ */ { if (ini_entry->modified) { if (ini_entry->on_modify) { @@ -64,17 +64,19 @@ static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS } return 0; } +/* }}} */ -static int zend_restore_ini_entry_wrapper(zend_ini_entry **ini_entry TSRMLS_DC) +static int zend_restore_ini_entry_wrapper(zend_ini_entry **ini_entry TSRMLS_DC) /* {{{ */ { zend_restore_ini_entry_cb(*ini_entry, ZEND_INI_STAGE_DEACTIVATE TSRMLS_CC); return 1; } +/* }}} */ /* * Startup / shutdown */ -ZEND_API int zend_ini_startup(TSRMLS_D) +ZEND_API int zend_ini_startup(TSRMLS_D) /* {{{ */ { registered_zend_ini_directives = (HashTable *) malloc(sizeof(HashTable)); @@ -85,25 +87,25 @@ ZEND_API int zend_ini_startup(TSRMLS_D) } return SUCCESS; } +/* }}} */ - -ZEND_API int zend_ini_shutdown(TSRMLS_D) +ZEND_API int zend_ini_shutdown(TSRMLS_D) /* {{{ */ { zend_hash_destroy(EG(ini_directives)); free(EG(ini_directives)); return SUCCESS; } +/* }}} */ - -ZEND_API int zend_ini_global_shutdown(TSRMLS_D) +ZEND_API int zend_ini_global_shutdown(TSRMLS_D) /* {{{ */ { zend_hash_destroy(registered_zend_ini_directives); free(registered_zend_ini_directives); return SUCCESS; } +/* }}} */ - -ZEND_API int zend_ini_deactivate(TSRMLS_D) +ZEND_API int zend_ini_deactivate(TSRMLS_D) /* {{{ */ { if (EG(modified_ini_directives)) { zend_hash_apply(EG(modified_ini_directives), (apply_func_t) zend_restore_ini_entry_wrapper TSRMLS_CC); @@ -113,10 +115,10 @@ ZEND_API int zend_ini_deactivate(TSRMLS_D) } return SUCCESS; } - +/* }}} */ #ifdef ZTS -ZEND_API int zend_copy_ini_directives(TSRMLS_D) +ZEND_API int zend_copy_ini_directives(TSRMLS_D) /* {{{ */ { zend_ini_entry ini_entry; @@ -128,10 +130,10 @@ ZEND_API int zend_copy_ini_directives(TSRMLS_D) zend_hash_copy(EG(ini_directives), registered_zend_ini_directives, NULL, &ini_entry, sizeof(zend_ini_entry)); return SUCCESS; } +/* }}} */ #endif - -static int ini_key_compare(const void *a, const void *b TSRMLS_DC) +static int ini_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ { Bucket *f; Bucket *s; @@ -150,18 +152,18 @@ static int ini_key_compare(const void *a, const void *b TSRMLS_DC) return zend_binary_strcasecmp(f->key.arKey.s, f->nKeyLength, s->key.arKey.s, s->nKeyLength); } } +/* }}} */ - -ZEND_API void zend_ini_sort_entries(TSRMLS_D) +ZEND_API void zend_ini_sort_entries(TSRMLS_D) /* {{{ */ { zend_hash_sort(EG(ini_directives), zend_qsort, ini_key_compare, 0 TSRMLS_CC); } +/* }}} */ /* * Registration / unregistration */ - -ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_number TSRMLS_DC) +ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_number TSRMLS_DC) /* {{{ */ { zend_ini_entry *p = ini_entry; zend_ini_entry *hashed_ini_entry; @@ -206,32 +208,32 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num } return SUCCESS; } +/* }}} */ - -ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC) +ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC) /* {{{ */ { zend_hash_apply_with_argument(registered_zend_ini_directives, (apply_func_arg_t) zend_remove_ini_entries, (void *) &module_number TSRMLS_CC); } - +/* }}} */ #ifdef ZTS -static int zend_ini_refresh_cache(zend_ini_entry *p, int stage TSRMLS_DC) +static int zend_ini_refresh_cache(zend_ini_entry *p, int stage TSRMLS_DC) /* {{{ */ { if (p->on_modify) { p->on_modify(p, p->value, p->value_length, p->mh_arg1, p->mh_arg2, p->mh_arg3, stage TSRMLS_CC); } return 0; } +/* }}} */ - -ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC) +ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC) /* {{{ */ { zend_hash_apply_with_argument(EG(ini_directives), (apply_func_arg_t) zend_ini_refresh_cache, (void *)(zend_uintptr_t) stage TSRMLS_CC); } +/* }}} */ #endif - -ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage) +ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage) /* {{{ */ { zend_ini_entry *ini_entry; char *duplicate; @@ -273,9 +275,9 @@ ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, return SUCCESS; } +/* }}} */ - -ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage) +ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage) /* {{{ */ { zend_ini_entry *ini_entry; TSRMLS_FETCH(); @@ -292,9 +294,9 @@ ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage) return SUCCESS; } +/* }}} */ - -ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)) +ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)) /* {{{ */ { zend_ini_entry *ini_entry; @@ -305,14 +307,12 @@ ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*di ini_entry->displayer = displayer; return SUCCESS; } - - +/* }}} */ /* * Data retrieval */ - -ZEND_API long zend_ini_long(char *name, uint name_length, int orig) +ZEND_API long zend_ini_long(char *name, uint name_length, int orig) /* {{{ */ { zend_ini_entry *ini_entry; TSRMLS_FETCH(); @@ -327,9 +327,9 @@ ZEND_API long zend_ini_long(char *name, uint name_length, int orig) return 0; } +/* }}} */ - -ZEND_API double zend_ini_double(char *name, uint name_length, int orig) +ZEND_API double zend_ini_double(char *name, uint name_length, int orig) /* {{{ */ { zend_ini_entry *ini_entry; TSRMLS_FETCH(); @@ -344,9 +344,9 @@ ZEND_API double zend_ini_double(char *name, uint name_length, int orig) return 0.0; } +/* }}} */ - -ZEND_API char *zend_ini_string(char *name, uint name_length, int orig) +ZEND_API char *zend_ini_string(char *name, uint name_length, int orig) /* {{{ */ { zend_ini_entry *ini_entry; TSRMLS_FETCH(); @@ -361,9 +361,10 @@ ZEND_API char *zend_ini_string(char *name, uint name_length, int orig) return ""; } +/* }}} */ #if TONY_20070307 -static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) +static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) /* {{{ */ { if (ini_entry->displayer) { ini_entry->displayer(ini_entry, type); @@ -399,10 +400,10 @@ static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) ZEND_WRITE(display_string, display_string_length); } } +/* }}} */ #endif - -ZEND_INI_DISP(zend_ini_boolean_displayer_cb) +ZEND_INI_DISP(zend_ini_boolean_displayer_cb) /* {{{ */ { int value, tmp_value_len; char *tmp_value; @@ -437,9 +438,9 @@ ZEND_INI_DISP(zend_ini_boolean_displayer_cb) ZEND_PUTS("Off"); } } +/* }}} */ - -ZEND_INI_DISP(zend_ini_color_displayer_cb) +ZEND_INI_DISP(zend_ini_color_displayer_cb) /* {{{ */ { char *value; @@ -464,9 +465,9 @@ ZEND_INI_DISP(zend_ini_color_displayer_cb) } } } +/* }}} */ - -ZEND_INI_DISP(display_link_numbers) +ZEND_INI_DISP(display_link_numbers) /* {{{ */ { char *value; @@ -486,11 +487,10 @@ ZEND_INI_DISP(display_link_numbers) } } } - +/* }}} */ /* Standard message handlers */ - -ZEND_API ZEND_INI_MH(OnUpdateBool) +ZEND_API ZEND_INI_MH(OnUpdateBool) /* {{{ */ { zend_bool *p; #ifndef ZTS @@ -517,9 +517,9 @@ ZEND_API ZEND_INI_MH(OnUpdateBool) } return SUCCESS; } +/* }}} */ - -ZEND_API ZEND_INI_MH(OnUpdateLong) +ZEND_API ZEND_INI_MH(OnUpdateLong) /* {{{ */ { long *p; #ifndef ZTS @@ -535,7 +535,9 @@ ZEND_API ZEND_INI_MH(OnUpdateLong) *p = zend_atoi(new_value, new_value_length); return SUCCESS; } -ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) +/* }}} */ + +ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) /* {{{ */ { long *p, tmp; #ifndef ZTS @@ -556,10 +558,9 @@ ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) return SUCCESS; } +/* }}} */ - - -ZEND_API ZEND_INI_MH(OnUpdateReal) +ZEND_API ZEND_INI_MH(OnUpdateReal) /* {{{ */ { double *p; #ifndef ZTS @@ -575,9 +576,9 @@ ZEND_API ZEND_INI_MH(OnUpdateReal) *p = zend_strtod(new_value, NULL); return SUCCESS; } +/* }}} */ - -ZEND_API ZEND_INI_MH(OnUpdateString) +ZEND_API ZEND_INI_MH(OnUpdateString) /* {{{ */ { char **p; #ifndef ZTS @@ -593,9 +594,9 @@ ZEND_API ZEND_INI_MH(OnUpdateString) *p = new_value; return SUCCESS; } +/* }}} */ - -ZEND_API ZEND_INI_MH(OnUpdateStringUnempty) +ZEND_API ZEND_INI_MH(OnUpdateStringUnempty) /* {{{ */ { char **p; #ifndef ZTS @@ -615,8 +616,9 @@ ZEND_API ZEND_INI_MH(OnUpdateStringUnempty) *p = new_value; return SUCCESS; } +/* }}} */ -ZEND_API ZEND_INI_MH(OnUpdateUTF8String) +ZEND_API ZEND_INI_MH(OnUpdateUTF8String) /* {{{ */ { UChar **p; UChar *ustr = NULL; @@ -655,6 +657,7 @@ ZEND_API ZEND_INI_MH(OnUpdateUTF8String) *p = ustr; return SUCCESS; } +/* }}} */ /* * Local variables: diff --git a/Zend/zend_iterators.c b/Zend/zend_iterators.c index 51fcaa56e6..ac1b1ee793 100755 --- a/Zend/zend_iterators.c +++ b/Zend/zend_iterators.c @@ -48,20 +48,22 @@ static zend_object_handlers iterator_object_handlers = { NULL /* count */ }; -ZEND_API void zend_register_iterator_wrapper(TSRMLS_D) +ZEND_API void zend_register_iterator_wrapper(TSRMLS_D) /* {{{ */ { INIT_CLASS_ENTRY(zend_iterator_class_entry, "__iterator_wrapper", NULL); free(zend_iterator_class_entry.name.s); zend_iterator_class_entry.name.s = "__iterator_wrapper"; } +/* }}} */ -static void iter_wrapper_dtor(void *object, zend_object_handle handle TSRMLS_DC) +static void iter_wrapper_dtor(void *object, zend_object_handle handle TSRMLS_DC) /* {{{ */ { zend_object_iterator *iter = (zend_object_iterator*)object; iter->funcs->dtor(iter TSRMLS_CC); } +/* }}} */ -ZEND_API zval *zend_iterator_wrap(zend_object_iterator *iter TSRMLS_DC) +ZEND_API zval *zend_iterator_wrap(zend_object_iterator *iter TSRMLS_DC) /* {{{ */ { zval *wrapped; @@ -72,9 +74,9 @@ ZEND_API zval *zend_iterator_wrap(zend_object_iterator *iter TSRMLS_DC) return wrapped; } +/* }}} */ -ZEND_API enum zend_object_iterator_kind zend_iterator_unwrap( - zval *array_ptr, zend_object_iterator **iter TSRMLS_DC) +ZEND_API enum zend_object_iterator_kind zend_iterator_unwrap(zval *array_ptr, zend_object_iterator **iter TSRMLS_DC) /* {{{ */ { switch (Z_TYPE_P(array_ptr)) { case IS_OBJECT: @@ -97,6 +99,7 @@ ZEND_API enum zend_object_iterator_kind zend_iterator_unwrap( return ZEND_ITER_INVALID; } } +/* }}} */ /* * Local variables: diff --git a/Zend/zend_list.c b/Zend/zend_list.c index ad53b1c22f..7b36bc48b9 100644 --- a/Zend/zend_list.c +++ b/Zend/zend_list.c @@ -31,8 +31,7 @@ ZEND_API int le_index_ptr; /* true global */ static HashTable list_destructors; - -ZEND_API int zend_list_insert(void *ptr, int type) +ZEND_API int zend_list_insert(void *ptr, int type) /* {{{ */ { int index; zend_rsrc_list_entry le; @@ -47,8 +46,9 @@ ZEND_API int zend_list_insert(void *ptr, int type) zend_hash_index_update(&EG(regular_list), index, (void *) &le, sizeof(zend_rsrc_list_entry), NULL); return index; } +/* }}} */ -ZEND_API int _zend_list_delete(int id TSRMLS_DC) +ZEND_API int _zend_list_delete(int id TSRMLS_DC) /* {{{ */ { zend_rsrc_list_entry *le; @@ -63,9 +63,9 @@ ZEND_API int _zend_list_delete(int id TSRMLS_DC) return FAILURE; } } +/* }}} */ - -ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC) +ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC) /* {{{ */ { zend_rsrc_list_entry *le; @@ -77,8 +77,9 @@ ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC) return NULL; } } +/* }}} */ -ZEND_API int _zend_list_addref(int id TSRMLS_DC) +ZEND_API int _zend_list_addref(int id TSRMLS_DC) /* {{{ */ { zend_rsrc_list_entry *le; @@ -90,9 +91,9 @@ ZEND_API int _zend_list_addref(int id TSRMLS_DC) return FAILURE; } } +/* }}} */ - -ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type) +ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type) /* {{{ */ { int rsrc_id; @@ -105,9 +106,9 @@ ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int r return rsrc_id; } +/* }}} */ - -ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, char *resource_type_name, int *found_resource_type, int num_resource_types, ...) +ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, char *resource_type_name, int *found_resource_type, int num_resource_types, ...) /* {{{ */ { int id; int actual_resource_type; @@ -164,9 +165,9 @@ ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, c return NULL; } +/* }}} */ - -void list_entry_destructor(void *ptr) +void list_entry_destructor(void *ptr) /* {{{ */ { zend_rsrc_list_entry *le = (zend_rsrc_list_entry *) ptr; zend_rsrc_list_dtors_entry *ld; @@ -190,9 +191,9 @@ void list_entry_destructor(void *ptr) zend_error(E_WARNING,"Unknown list entry type in request shutdown (%d)", le->type); } } +/* }}} */ - -void plist_entry_destructor(void *ptr) +void plist_entry_destructor(void *ptr) /* {{{ */ { zend_rsrc_list_entry *le = (zend_rsrc_list_entry *) ptr; zend_rsrc_list_dtors_entry *ld; @@ -216,9 +217,9 @@ void plist_entry_destructor(void *ptr) zend_error(E_WARNING,"Unknown persistent list entry type in module shutdown (%d)", le->type); } } +/* }}} */ - -int zend_init_rsrc_list(TSRMLS_D) +int zend_init_rsrc_list(TSRMLS_D) /* {{{ */ { if (zend_hash_init(&EG(regular_list), 0, NULL, list_entry_destructor, 0)==SUCCESS) { EG(regular_list).nNextFreeElement=1; /* we don't want resource id 0 */ @@ -227,20 +228,21 @@ int zend_init_rsrc_list(TSRMLS_D) return FAILURE; } } +/* }}} */ - -int zend_init_rsrc_plist(TSRMLS_D) +int zend_init_rsrc_plist(TSRMLS_D) /* {{{ */ { return zend_hash_init_ex(&EG(persistent_list), 0, NULL, plist_entry_destructor, 1, 0); } +/* }}} */ - -void zend_destroy_rsrc_list(HashTable *ht TSRMLS_DC) +void zend_destroy_rsrc_list(HashTable *ht TSRMLS_DC) /* {{{ */ { zend_hash_graceful_reverse_destroy(ht); } +/* }}} */ -static int clean_module_resource(zend_rsrc_list_entry *le, int *resource_id TSRMLS_DC) +static int clean_module_resource(zend_rsrc_list_entry *le, int *resource_id TSRMLS_DC) /* {{{ */ { if (le->type == *resource_id) { return 1; @@ -248,9 +250,9 @@ static int clean_module_resource(zend_rsrc_list_entry *le, int *resource_id TSRM return 0; } } +/* }}} */ - -static int zend_clean_module_rsrc_dtors_cb(zend_rsrc_list_dtors_entry *ld, int *module_number TSRMLS_DC) +static int zend_clean_module_rsrc_dtors_cb(zend_rsrc_list_dtors_entry *ld, int *module_number TSRMLS_DC) /* {{{ */ { if (ld->module_number == *module_number) { zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) clean_module_resource, (void *) &(ld->resource_id) TSRMLS_CC); @@ -260,15 +262,15 @@ static int zend_clean_module_rsrc_dtors_cb(zend_rsrc_list_dtors_entry *ld, int * return 0; } } +/* }}} */ - -void zend_clean_module_rsrc_dtors(int module_number TSRMLS_DC) +void zend_clean_module_rsrc_dtors(int module_number TSRMLS_DC) /* {{{ */ { zend_hash_apply_with_argument(&list_destructors, (apply_func_arg_t) zend_clean_module_rsrc_dtors_cb, (void *) &module_number TSRMLS_CC); } +/* }}} */ - -ZEND_API int zend_register_list_destructors(void (*ld)(void *), void (*pld)(void *), int module_number) +ZEND_API int zend_register_list_destructors(void (*ld)(void *), void (*pld)(void *), int module_number) /* {{{ */ { zend_rsrc_list_dtors_entry lde; @@ -289,9 +291,9 @@ ZEND_API int zend_register_list_destructors(void (*ld)(void *), void (*pld)(void } return list_destructors.nNextFreeElement-1; } +/* }}} */ - -ZEND_API int zend_register_list_destructors_ex(rsrc_dtor_func_t ld, rsrc_dtor_func_t pld, char *type_name, int module_number) +ZEND_API int zend_register_list_destructors_ex(rsrc_dtor_func_t ld, rsrc_dtor_func_t pld, char *type_name, int module_number) /* {{{ */ { zend_rsrc_list_dtors_entry lde; @@ -313,8 +315,9 @@ ZEND_API int zend_register_list_destructors_ex(rsrc_dtor_func_t ld, rsrc_dtor_fu } return list_destructors.nNextFreeElement-1; } +/* }}} */ -ZEND_API int zend_fetch_list_dtor_id(char *type_name) +ZEND_API int zend_fetch_list_dtor_id(char *type_name) /* {{{ */ { zend_rsrc_list_dtors_entry *lde; HashPosition pos; @@ -332,8 +335,9 @@ ZEND_API int zend_fetch_list_dtor_id(char *type_name) return 0; } +/* }}} */ -int zend_init_rsrc_list_dtors(void) +int zend_init_rsrc_list_dtors(void) /* {{{ */ { int retval; @@ -342,15 +346,15 @@ int zend_init_rsrc_list_dtors(void) return retval; } +/* }}} */ - -void zend_destroy_rsrc_list_dtors(void) +void zend_destroy_rsrc_list_dtors(void) /* {{{ */ { zend_hash_destroy(&list_destructors); } +/* }}} */ - -char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC) +char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC) /* {{{ */ { zend_rsrc_list_dtors_entry *lde; int rsrc_type; @@ -364,6 +368,7 @@ char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC) return NULL; } } +/* }}} */ /* * Local variables: diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c index e932801ef3..29e747ac1c 100644 --- a/Zend/zend_llist.c +++ b/Zend/zend_llist.c @@ -23,7 +23,7 @@ #include "zend_llist.h" #include "zend_qsort.h" -ZEND_API void zend_llist_init(zend_llist *l, size_t size, llist_dtor_func_t dtor, unsigned char persistent) +ZEND_API void zend_llist_init(zend_llist *l, size_t size, llist_dtor_func_t dtor, unsigned char persistent) /* {{{ */ { l->head = NULL; l->tail = NULL; @@ -32,9 +32,9 @@ ZEND_API void zend_llist_init(zend_llist *l, size_t size, llist_dtor_func_t dtor l->dtor = dtor; l->persistent = persistent; } +/* }}} */ - -ZEND_API void zend_llist_add_element(zend_llist *l, void *element) +ZEND_API void zend_llist_add_element(zend_llist *l, void *element) /* {{{ */ { zend_llist_element *tmp = pemalloc(sizeof(zend_llist_element)+l->size-1, l->persistent); @@ -50,9 +50,9 @@ ZEND_API void zend_llist_add_element(zend_llist *l, void *element) ++l->count; } +/* }}} */ - -ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element) +ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element) /* {{{ */ { zend_llist_element *tmp = pemalloc(sizeof(zend_llist_element)+l->size-1, l->persistent); @@ -68,7 +68,7 @@ ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element) ++l->count; } - +/* }}} */ #define DEL_LLIST_ELEMENT(current, l) \ if ((current)->prev) {\ @@ -88,7 +88,7 @@ ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element) --l->count; -ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int (*compare)(void *element1, void *element2)) +ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int (*compare)(void *element1, void *element2)) /* {{{ */ { zend_llist_element *current=l->head; zend_llist_element *next; @@ -102,9 +102,9 @@ ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int (*compare current = next; } } +/* }}} */ - -ZEND_API void zend_llist_destroy(zend_llist *l) +ZEND_API void zend_llist_destroy(zend_llist *l) /* {{{ */ { zend_llist_element *current=l->head, *next; @@ -119,16 +119,16 @@ ZEND_API void zend_llist_destroy(zend_llist *l) l->count = 0; } +/* }}} */ - -ZEND_API void zend_llist_clean(zend_llist *l) +ZEND_API void zend_llist_clean(zend_llist *l) /* {{{ */ { zend_llist_destroy(l); l->head = l->tail = NULL; } +/* }}} */ - -ZEND_API void *zend_llist_remove_tail(zend_llist *l) +ZEND_API void *zend_llist_remove_tail(zend_llist *l) /* {{{ */ { zend_llist_element *old_tail; void *data; @@ -155,9 +155,9 @@ ZEND_API void *zend_llist_remove_tail(zend_llist *l) return NULL; } +/* }}} */ - -ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src) +ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src) /* {{{ */ { zend_llist_element *ptr; @@ -168,9 +168,9 @@ ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src) ptr = ptr->next; } } +/* }}} */ - -ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data)) +ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data)) /* {{{ */ { zend_llist_element *element, *next; @@ -183,9 +183,9 @@ ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data)) element = next; } } +/* }}} */ - -ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC) +ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC) /* {{{ */ { zend_llist_element *element; @@ -193,8 +193,9 @@ ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC) func(element->data TSRMLS_CC); } } +/* }}} */ -ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func TSRMLS_DC) +ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func TSRMLS_DC) /* {{{ */ { size_t i; @@ -226,9 +227,9 @@ ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func TSRM l->tail = elements[i-1]; efree(elements); } +/* }}} */ - -ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg TSRMLS_DC) +ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg TSRMLS_DC) /* {{{ */ { zend_llist_element *element; @@ -236,9 +237,9 @@ ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg func(element->data, arg TSRMLS_CC); } } +/* }}} */ - -ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func TSRMLS_DC, int num_args, ...) +ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func TSRMLS_DC, int num_args, ...) /* {{{ */ { zend_llist_element *element; va_list args; @@ -249,15 +250,15 @@ ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_ar } va_end(args); } +/* }}} */ - -ZEND_API int zend_llist_count(zend_llist *l) +ZEND_API int zend_llist_count(zend_llist *l) /* {{{ */ { return l->count; } +/* }}} */ - -ZEND_API void *zend_llist_get_first_ex(zend_llist *l, zend_llist_position *pos) +ZEND_API void *zend_llist_get_first_ex(zend_llist *l, zend_llist_position *pos) /* {{{ */ { zend_llist_position *current = pos ? pos : &l->traverse_ptr; @@ -268,9 +269,9 @@ ZEND_API void *zend_llist_get_first_ex(zend_llist *l, zend_llist_position *pos) return NULL; } } +/* }}} */ - -ZEND_API void *zend_llist_get_last_ex(zend_llist *l, zend_llist_position *pos) +ZEND_API void *zend_llist_get_last_ex(zend_llist *l, zend_llist_position *pos) /* {{{ */ { zend_llist_position *current = pos ? pos : &l->traverse_ptr; @@ -281,9 +282,9 @@ ZEND_API void *zend_llist_get_last_ex(zend_llist *l, zend_llist_position *pos) return NULL; } } +/* }}} */ - -ZEND_API void *zend_llist_get_next_ex(zend_llist *l, zend_llist_position *pos) +ZEND_API void *zend_llist_get_next_ex(zend_llist *l, zend_llist_position *pos) /* {{{ */ { zend_llist_position *current = pos ? pos : &l->traverse_ptr; @@ -295,9 +296,9 @@ ZEND_API void *zend_llist_get_next_ex(zend_llist *l, zend_llist_position *pos) } return NULL; } +/* }}} */ - -ZEND_API void *zend_llist_get_prev_ex(zend_llist *l, zend_llist_position *pos) +ZEND_API void *zend_llist_get_prev_ex(zend_llist *l, zend_llist_position *pos) /* {{{ */ { zend_llist_position *current = pos ? pos : &l->traverse_ptr; @@ -309,6 +310,7 @@ ZEND_API void *zend_llist_get_prev_ex(zend_llist *l, zend_llist_position *pos) } return NULL; } +/* }}} */ /* * Local variables: diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 7fc58c27fb..89054196bb 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -49,20 +49,22 @@ called, we cal __call handler. */ -ZEND_API HashTable *zend_std_get_properties(zval *object TSRMLS_DC) +ZEND_API HashTable *zend_std_get_properties(zval *object TSRMLS_DC) /* {{{ */ { zend_object *zobj; zobj = Z_OBJ_P(object); return zobj->properties; } +/* }}} */ -ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp TSRMLS_DC) +ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */ { *is_temp = 0; return zend_std_get_properties(object TSRMLS_CC); } +/* }}} */ -static zval *zend_std_call_getter(zval *object, zval *member TSRMLS_DC) +static zval *zend_std_call_getter(zval *object, zval *member TSRMLS_DC) /* {{{ */ { zval *retval = NULL; zend_class_entry *ce = Z_OBJCE_P(object); @@ -85,8 +87,9 @@ static zval *zend_std_call_getter(zval *object, zval *member TSRMLS_DC) return retval; } +/* }}} */ -static int zend_std_call_setter(zval *object, zval *member, zval *value TSRMLS_DC) +static int zend_std_call_setter(zval *object, zval *member, zval *value TSRMLS_DC) /* {{{ */ { zval *retval = NULL; int result; @@ -114,8 +117,9 @@ static int zend_std_call_setter(zval *object, zval *member, zval *value TSRMLS_D return FAILURE; } } +/* }}} */ -static void zend_std_call_unsetter(zval *object, zval *member TSRMLS_DC) +static void zend_std_call_unsetter(zval *object, zval *member TSRMLS_DC) /* {{{ */ { zend_class_entry *ce = Z_OBJCE_P(object); @@ -129,8 +133,9 @@ static void zend_std_call_unsetter(zval *object, zval *member TSRMLS_DC) zval_ptr_dtor(&member); } +/* }}} */ -static zval *zend_std_call_issetter(zval *object, zval *member TSRMLS_DC) +static zval *zend_std_call_issetter(zval *object, zval *member TSRMLS_DC) /* {{{ */ { zval *retval = NULL; zend_class_entry *ce = Z_OBJCE_P(object); @@ -149,8 +154,9 @@ static zval *zend_std_call_issetter(zval *object, zval *member TSRMLS_DC) return retval; } +/* }}} */ -static int zend_verify_property_access(zend_property_info *property_info, zend_class_entry *ce TSRMLS_DC) +static int zend_verify_property_access(zend_property_info *property_info, zend_class_entry *ce TSRMLS_DC) /* {{{ */ { switch (property_info->flags & ZEND_ACC_PPP_MASK) { case ZEND_ACC_PUBLIC: @@ -167,8 +173,9 @@ static int zend_verify_property_access(zend_property_info *property_info, zend_c } return 0; } +/* }}} */ -static inline zend_bool is_derived_class(zend_class_entry *child_class, zend_class_entry *parent_class) +static inline zend_bool is_derived_class(zend_class_entry *child_class, zend_class_entry *parent_class) /* {{{ */ { child_class = child_class->parent; while (child_class) { @@ -180,8 +187,9 @@ static inline zend_bool is_derived_class(zend_class_entry *child_class, zend_cla return 0; } +/* }}} */ -ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zval *member, int silent TSRMLS_DC) +ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zval *member, int silent TSRMLS_DC) /* {{{ */ { zend_property_info *property_info = NULL; zend_property_info *scope_property_info; @@ -250,9 +258,9 @@ ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce } return property_info; } +/* }}} */ - -ZEND_API int zend_check_property_access(zend_object *zobj, zend_uchar utype, zstr prop_info_name, int prop_info_name_len TSRMLS_DC) +ZEND_API int zend_check_property_access(zend_object *zobj, zend_uchar utype, zstr prop_info_name, int prop_info_name_len TSRMLS_DC) /* {{{ */ { zend_property_info *property_info; zstr class_name, prop_name; @@ -282,8 +290,9 @@ ZEND_API int zend_check_property_access(zend_object *zobj, zend_uchar utype, zst } return zend_verify_property_access(property_info, zobj->ce TSRMLS_CC) ? SUCCESS : FAILURE; } +/* }}} */ -static int zend_get_property_guard(zend_object *zobj, zend_property_info *property_info, zval *member, zend_guard **pguard TSRMLS_DC) +static int zend_get_property_guard(zend_object *zobj, zend_property_info *property_info, zval *member, zend_guard **pguard TSRMLS_DC) /* {{{ */ { zend_property_info info; zend_guard stub; @@ -306,8 +315,9 @@ static int zend_get_property_guard(zend_object *zobj, zend_property_info *proper stub.in_isset = 0; return zend_u_hash_quick_add(zobj->guards, UG(unicode)?IS_UNICODE:IS_STRING, property_info->name, property_info->name_length+1, property_info->h, (void**)&stub, sizeof(stub), (void**) pguard); } +/* }}} */ -zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC) +zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC) /* {{{ */ { zend_object *zobj; zval *tmp_member = NULL; @@ -380,9 +390,9 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC) } return *retval; } +/* }}} */ - -static void zend_std_write_property(zval *object, zval *member, zval *value TSRMLS_DC) +static void zend_std_write_property(zval *object, zval *member, zval *value TSRMLS_DC) /* {{{ */ { zend_object *zobj; zval *tmp_member = NULL; @@ -459,8 +469,9 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM zval_ptr_dtor(&tmp_member); } } +/* }}} */ -zval *zend_std_read_dimension(zval *object, zval *offset, int type TSRMLS_DC) +zval *zend_std_read_dimension(zval *object, zval *offset, int type TSRMLS_DC) /* {{{ */ { zend_class_entry *ce = Z_OBJCE_P(object); zval *retval; @@ -492,9 +503,9 @@ zval *zend_std_read_dimension(zval *object, zval *offset, int type TSRMLS_DC) return 0; } } +/* }}} */ - -static void zend_std_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC) +static void zend_std_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC) /* {{{ */ { zend_class_entry *ce = Z_OBJCE_P(object); @@ -510,9 +521,9 @@ static void zend_std_write_dimension(zval *object, zval *offset, zval *value TSR zend_error(E_ERROR, "Cannot use object of type %v as array", ce->name); } } +/* }}} */ - -static int zend_std_has_dimension(zval *object, zval *offset, int check_empty TSRMLS_DC) +static int zend_std_has_dimension(zval *object, zval *offset, int check_empty TSRMLS_DC) /* {{{ */ { zend_class_entry *ce = Z_OBJCE_P(object); zval *retval; @@ -541,9 +552,9 @@ static int zend_std_has_dimension(zval *object, zval *offset, int check_empty TS } return result; } +/* }}} */ - -static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC) +static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC) /* {{{ */ { zend_object *zobj; zval tmp_member; @@ -588,9 +599,9 @@ static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC } return retval; } +/* }}} */ - -static void zend_std_unset_property(zval *object, zval *member TSRMLS_DC) +static void zend_std_unset_property(zval *object, zval *member TSRMLS_DC) /* {{{ */ { zend_object *zobj; zval *tmp_member = NULL; @@ -626,9 +637,9 @@ static void zend_std_unset_property(zval *object, zval *member TSRMLS_DC) zval_ptr_dtor(&tmp_member); } } +/* }}} */ - -static void zend_std_unset_dimension(zval *object, zval *offset TSRMLS_DC) +static void zend_std_unset_dimension(zval *object, zval *offset TSRMLS_DC) /* {{{ */ { zend_class_entry *ce = Z_OBJCE_P(object); @@ -640,9 +651,9 @@ static void zend_std_unset_dimension(zval *object, zval *offset TSRMLS_DC) zend_error(E_ERROR, "Cannot use object of type %v as array", ce->name); } } +/* }}} */ - -ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) +ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */ { zend_internal_function *func = (zend_internal_function *)EG(function_state_ptr)->function; zval *method_name_ptr, *method_args_ptr; @@ -685,12 +696,13 @@ ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) /* destruct the function also, then - we have allocated it in get_method */ efree(func); } +/* }}} */ /* Ensures that we're allowed to call a private method. * Returns the function address that should be called, or NULL * if no such function exists. */ -static inline zend_function *zend_check_private_int(zend_function *fbc, zend_class_entry *ce, zstr function_name_strval, int function_name_strlen TSRMLS_DC) +static inline zend_function *zend_check_private_int(zend_function *fbc, zend_class_entry *ce, zstr function_name_strval, int function_name_strlen TSRMLS_DC) /* {{{ */ { if (!ce) { return 0; @@ -723,17 +735,17 @@ static inline zend_function *zend_check_private_int(zend_function *fbc, zend_cla } return NULL; } +/* }}} */ - -ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, zstr function_name_strval, int function_name_strlen TSRMLS_DC) +ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, zstr function_name_strval, int function_name_strlen TSRMLS_DC) /* {{{ */ { return zend_check_private_int(fbc, ce, function_name_strval, function_name_strlen TSRMLS_CC) != NULL; } - +/* }}} */ /* Ensures that we're allowed to call a protected method. */ -ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope) +ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope) /* {{{ */ { zend_class_entry *fbc_scope = ce; @@ -758,15 +770,15 @@ ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope) } return 0; } +/* }}} */ - -static inline zend_class_entry * zend_get_function_root_class(zend_function *fbc) +static inline zend_class_entry * zend_get_function_root_class(zend_function *fbc) /* {{{ */ { return fbc->common.prototype ? fbc->common.prototype->common.scope : fbc->common.scope; } +/* }}} */ - -static union _zend_function *zend_std_get_method(zval **object_ptr, zstr method_name, int method_len TSRMLS_DC) +static union _zend_function *zend_std_get_method(zval **object_ptr, zstr method_name, int method_len TSRMLS_DC) /* {{{ */ { zend_object *zobj; zend_function *fbc; @@ -842,10 +854,10 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, zstr method_ efree(lc_method_name.v); return fbc; } - +/* }}} */ /* This is not (yet?) in the API, but it belongs in the built-in objects callbacks */ -ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zstr function_name_strval, int function_name_strlen TSRMLS_DC) +ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zstr function_name_strval, int function_name_strlen TSRMLS_DC) /* {{{ */ { zend_function *fbc; /* FIXME: type is default */ @@ -888,9 +900,9 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zstr fu return fbc; } +/* }}} */ - -ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, zend_uchar type, zstr property_name, int property_name_len, zend_bool silent TSRMLS_DC) +ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, zend_uchar type, zstr property_name, int property_name_len, zend_bool silent TSRMLS_DC) /* {{{ */ { zval **retval = NULL; zend_class_entry *tmp_ce = ce; @@ -931,16 +943,16 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, zend_uchar ty return retval; } +/* }}} */ - -ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_uchar type, zstr property_name, int property_name_len TSRMLS_DC) +ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_uchar type, zstr property_name, int property_name_len TSRMLS_DC) /* {{{ */ { zend_error(E_ERROR, "Attempt to unset static property %v::$%R", ce->name, type, property_name); return 0; } +/* }}} */ - -ZEND_API union _zend_function *zend_std_get_constructor(zval *object TSRMLS_DC) +ZEND_API union _zend_function *zend_std_get_constructor(zval *object TSRMLS_DC) /* {{{ */ { zend_object *zobj = Z_OBJ_P(object); zend_function *constructor = zobj->ce->constructor; @@ -975,12 +987,11 @@ ZEND_API union _zend_function *zend_std_get_constructor(zval *object TSRMLS_DC) return constructor; } - +/* }}} */ int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2 TSRMLS_DC); - -static int zend_std_compare_objects(zval *o1, zval *o2 TSRMLS_DC) +static int zend_std_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */ { zend_object *zobj1, *zobj2; @@ -992,8 +1003,9 @@ static int zend_std_compare_objects(zval *o1, zval *o2 TSRMLS_DC) } return zend_compare_symbol_tables_i(zobj1->properties, zobj2->properties TSRMLS_CC); } +/* }}} */ -static int zend_std_has_property(zval *object, zval *member, int has_set_exists TSRMLS_DC) +static int zend_std_has_property(zval *object, zval *member, int has_set_exists TSRMLS_DC) /* {{{ */ { zend_object *zobj; int result; @@ -1066,17 +1078,18 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists } return result; } +/* }}} */ - -zend_class_entry *zend_std_object_get_class(zval *object TSRMLS_DC) +zend_class_entry *zend_std_object_get_class(zval *object TSRMLS_DC) /* {{{ */ { zend_object *zobj; zobj = Z_OBJ_P(object); return zobj->ce; } +/* }}} */ -int zend_std_object_get_class_name(zval *object, zstr *class_name, zend_uint *class_name_len, int parent TSRMLS_DC) +int zend_std_object_get_class_name(zval *object, zstr *class_name, zend_uint *class_name_len, int parent TSRMLS_DC) /* {{{ */ { zend_object *zobj; zend_class_entry *ce; @@ -1099,8 +1112,9 @@ int zend_std_object_get_class_name(zval *object, zstr *class_name, zend_uint *cl } return SUCCESS; } +/* }}} */ -ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type, void *extra TSRMLS_DC) +ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type, void *extra TSRMLS_DC) /* {{{ */ { zval *retval; zend_class_entry *ce; @@ -1165,7 +1179,7 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty } return FAILURE; } - +/* }}} */ ZEND_API zend_object_handlers std_object_handlers = { zend_objects_store_add_ref, /* add_ref */ diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c index 00531b643d..2afaaf6136 100644 --- a/Zend/zend_objects.c +++ b/Zend/zend_objects.c @@ -26,7 +26,7 @@ #include "zend_interfaces.h" #include "zend_exceptions.h" -ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSRMLS_DC) +ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSRMLS_DC) /* {{{ */ { ALLOC_HASHTABLE(object->properties); zend_u_hash_init(object->properties, 0, NULL, ZVAL_PTR_DTOR, 0, UG(unicode)); @@ -34,8 +34,9 @@ ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSR object->ce = ce; object->guards = NULL; } +/* }}} */ -ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC) +ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC) /* {{{ */ { if (object->guards) { zend_hash_destroy(object->guards); @@ -46,8 +47,9 @@ ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC) FREE_HASHTABLE(object->properties); } } +/* }}} */ -ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handle handle TSRMLS_DC) +ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handle handle TSRMLS_DC) /* {{{ */ { zend_function *destructor = object->ce->destructor; @@ -115,8 +117,9 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl zval_ptr_dtor(&obj); } } +/* }}} */ -ZEND_API void zend_objects_free_object_storage(zend_object *object TSRMLS_DC) +ZEND_API void zend_objects_free_object_storage(zend_object *object TSRMLS_DC) /* {{{ */ { if (object->guards) { zend_hash_destroy(object->guards); @@ -126,8 +129,9 @@ ZEND_API void zend_objects_free_object_storage(zend_object *object TSRMLS_DC) FREE_HASHTABLE(object->properties); efree(object); } +/* }}} */ -ZEND_API zend_object_value zend_objects_new(zend_object **object, zend_class_entry *class_type TSRMLS_DC) +ZEND_API zend_object_value zend_objects_new(zend_object **object, zend_class_entry *class_type TSRMLS_DC) /* {{{ */ { zend_object_value retval; @@ -138,13 +142,15 @@ ZEND_API zend_object_value zend_objects_new(zend_object **object, zend_class_ent (*object)->guards = NULL; return retval; } +/* }}} */ -ZEND_API zend_object *zend_objects_get_address(zval *zobject TSRMLS_DC) +ZEND_API zend_object *zend_objects_get_address(zval *zobject TSRMLS_DC) /* {{{ */ { return (zend_object *)zend_object_store_get_object(zobject TSRMLS_CC); } +/* }}} */ -ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object_value new_obj_val, zend_object *old_object, zend_object_handle handle TSRMLS_DC) +ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object_value new_obj_val, zend_object *old_object, zend_object_handle handle TSRMLS_DC) /* {{{ */ { zend_hash_copy(new_object->properties, old_object->properties, (copy_ctor_func_t) zval_add_ref, (void *) NULL /* Not used anymore */, sizeof(zval *)); if (old_object->ce->clone) { @@ -160,8 +166,9 @@ ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object_va zval_ptr_dtor(&new_obj); } } +/* }}} */ -ZEND_API zend_object_value zend_objects_clone_obj(zval *zobject TSRMLS_DC) +ZEND_API zend_object_value zend_objects_clone_obj(zval *zobject TSRMLS_DC) /* {{{ */ { zend_object_value new_obj_val; zend_object *old_object; @@ -180,6 +187,7 @@ ZEND_API zend_object_value zend_objects_clone_obj(zval *zobject TSRMLS_DC) return new_obj_val; } +/* }}} */ /* * Local variables: diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c index e004253a36..dd06c07a3f 100644 --- a/Zend/zend_objects_API.c +++ b/Zend/zend_objects_API.c @@ -27,7 +27,7 @@ #define ZEND_DEBUG_OBJECTS 0 -ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint init_size) +ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint init_size) /* {{{ */ { objects->object_buckets = (zend_object_store_bucket *) emalloc(init_size * sizeof(zend_object_store_bucket)); objects->top = 1; /* Skip 0 so that handles are true */ @@ -35,14 +35,16 @@ ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint ini objects->free_list_head = -1; memset(&objects->object_buckets[0], 0, sizeof(zend_object_store_bucket)); } +/* }}} */ -ZEND_API void zend_objects_store_destroy(zend_objects_store *objects) +ZEND_API void zend_objects_store_destroy(zend_objects_store *objects) /* {{{ */ { efree(objects->object_buckets); objects->object_buckets = NULL; } +/* }}} */ -ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TSRMLS_DC) +ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TSRMLS_DC) /* {{{ */ { zend_uint i = 1; @@ -61,8 +63,9 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS } } } +/* }}} */ -ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSRMLS_DC) +ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSRMLS_DC) /* {{{ */ { zend_uint i; @@ -75,8 +78,9 @@ ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSR } } } +/* }}} */ -ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects TSRMLS_DC) +ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects TSRMLS_DC) /* {{{ */ { zend_uint i = 1; @@ -92,11 +96,10 @@ ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects } } } - +/* }}} */ /* Store objects API */ - -ZEND_API zend_object_handle zend_objects_store_put(void *object, zend_objects_store_dtor_t dtor, zend_objects_free_object_storage_t free_storage, zend_objects_store_clone_t clone TSRMLS_DC) +ZEND_API zend_object_handle zend_objects_store_put(void *object, zend_objects_store_dtor_t dtor, zend_objects_free_object_storage_t free_storage, zend_objects_store_clone_t clone TSRMLS_DC) /* {{{ */ { zend_object_handle handle; struct _store_object *obj; @@ -127,15 +130,17 @@ ZEND_API zend_object_handle zend_objects_store_put(void *object, zend_objects_st #endif return handle; } +/* }}} */ -ZEND_API zend_uint zend_objects_store_get_refcount(zval *object TSRMLS_DC) +ZEND_API zend_uint zend_objects_store_get_refcount(zval *object TSRMLS_DC) /* {{{ */ { zend_object_handle handle = Z_OBJ_HANDLE_P(object); return EG(objects_store).object_buckets[handle].bucket.obj.refcount; } +/* }}} */ -ZEND_API void zend_objects_store_add_ref(zval *object TSRMLS_DC) +ZEND_API void zend_objects_store_add_ref(zval *object TSRMLS_DC) /* {{{ */ { zend_object_handle handle = Z_OBJ_HANDLE_P(object); @@ -144,29 +149,32 @@ ZEND_API void zend_objects_store_add_ref(zval *object TSRMLS_DC) fprintf(stderr, "Increased refcount of object id #%d\n", handle); #endif } +/* }}} */ -ZEND_API int zend_objects_is_destructor_called(zend_object_handle handle TSRMLS_DC) +ZEND_API int zend_objects_is_destructor_called(zend_object_handle handle TSRMLS_DC) /* {{{ */ { if (EG(objects_store).object_buckets[handle].valid) { return EG(objects_store).object_buckets[handle].destructor_called; } return 1; } +/* }}} */ /* * Add a reference to an objects store entry given the object handle. */ -ZEND_API void zend_objects_store_add_ref_by_handle(zend_object_handle handle TSRMLS_DC) +ZEND_API void zend_objects_store_add_ref_by_handle(zend_object_handle handle TSRMLS_DC) /* {{{ */ { EG(objects_store).object_buckets[handle].bucket.obj.refcount++; } +/* }}} */ #define ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST() \ EG(objects_store).object_buckets[handle].bucket.free_list.next = EG(objects_store).free_list_head; \ EG(objects_store).free_list_head = handle; \ EG(objects_store).object_buckets[handle].valid = 0; -ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC) +ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC) /* {{{ */ { zend_object_handle handle; @@ -176,11 +184,12 @@ ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC) zend_objects_store_del_ref_by_handle(handle TSRMLS_CC); zobject->refcount--; } +/* }}} */ /* * Delete a reference to an objects store entry given the object handle. */ -ZEND_API void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSRMLS_DC) +ZEND_API void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSRMLS_DC) /* {{{ */ { struct _store_object *obj; int failure = 0; @@ -234,8 +243,9 @@ ZEND_API void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSR zend_bailout(); } } +/* }}} */ -ZEND_API zend_object_value zend_objects_store_clone_obj(zval *zobject TSRMLS_DC) +ZEND_API zend_object_value zend_objects_store_clone_obj(zval *zobject TSRMLS_DC) /* {{{ */ { zend_object_value retval; void *new_object; @@ -255,21 +265,24 @@ ZEND_API zend_object_value zend_objects_store_clone_obj(zval *zobject TSRMLS_DC) return retval; } +/* }}} */ -ZEND_API void *zend_object_store_get_object(zval *zobject TSRMLS_DC) +ZEND_API void *zend_object_store_get_object(zval *zobject TSRMLS_DC) /* {{{ */ { zend_object_handle handle = Z_OBJ_HANDLE_P(zobject); return EG(objects_store).object_buckets[handle].bucket.obj.object; } +/* }}} */ /* * Retrieve an entry from the objects store given the object handle. */ -ZEND_API void *zend_object_store_get_object_by_handle(zend_object_handle handle TSRMLS_DC) +ZEND_API void *zend_object_store_get_object_by_handle(zend_object_handle handle TSRMLS_DC) /* {{{ */ { return EG(objects_store).object_buckets[handle].bucket.obj.object; } +/* }}} */ /* zend_object_store_set_object: * It is ONLY valid to call this function from within the constructor of an @@ -278,22 +291,22 @@ ZEND_API void *zend_object_store_get_object_by_handle(zend_object_handle handle * from the constructor function. You MUST NOT use this function for any other * weird games, or call it at any other time after the object is constructed. * */ -ZEND_API void zend_object_store_set_object(zval *zobject, void *object TSRMLS_DC) +ZEND_API void zend_object_store_set_object(zval *zobject, void *object TSRMLS_DC) /* {{{ */ { zend_object_handle handle = Z_OBJ_HANDLE_P(zobject); EG(objects_store).object_buckets[handle].bucket.obj.object = object; } - +/* }}} */ /* Called when the ctor was terminated by an exception */ -ZEND_API void zend_object_store_ctor_failed(zval *zobject TSRMLS_DC) +ZEND_API void zend_object_store_ctor_failed(zval *zobject TSRMLS_DC) /* {{{ */ { zend_object_handle handle = Z_OBJ_HANDLE_P(zobject); EG(objects_store).object_buckets[handle].destructor_called = 1; } - +/* }}} */ /* Proxy objects workings */ typedef struct _zend_proxy_object { @@ -303,14 +316,15 @@ typedef struct _zend_proxy_object { static zend_object_handlers zend_object_proxy_handlers; -ZEND_API void zend_objects_proxy_free_storage(zend_proxy_object *object TSRMLS_DC) +ZEND_API void zend_objects_proxy_free_storage(zend_proxy_object *object TSRMLS_DC) /* {{{ */ { zval_ptr_dtor(&object->object); zval_ptr_dtor(&object->property); efree(object); } +/* }}} */ -ZEND_API void zend_objects_proxy_clone(zend_proxy_object *object, zend_proxy_object **object_clone TSRMLS_DC) +ZEND_API void zend_objects_proxy_clone(zend_proxy_object *object, zend_proxy_object **object_clone TSRMLS_DC) /* {{{ */ { *object_clone = emalloc(sizeof(zend_proxy_object)); (*object_clone)->object = object->object; @@ -318,8 +332,9 @@ ZEND_API void zend_objects_proxy_clone(zend_proxy_object *object, zend_proxy_obj zval_add_ref(&(*object_clone)->property); zval_add_ref(&(*object_clone)->object); } +/* }}} */ -ZEND_API zval *zend_object_create_proxy(zval *object, zval *member TSRMLS_DC) +ZEND_API zval *zend_object_create_proxy(zval *object, zval *member TSRMLS_DC) /* {{{ */ { zend_proxy_object *pobj = emalloc(sizeof(zend_proxy_object)); zval *retval; @@ -336,8 +351,9 @@ ZEND_API zval *zend_object_create_proxy(zval *object, zval *member TSRMLS_DC) return retval; } +/* }}} */ -ZEND_API void zend_object_proxy_set(zval **property, zval *value TSRMLS_DC) +ZEND_API void zend_object_proxy_set(zval **property, zval *value TSRMLS_DC) /* {{{ */ { zend_proxy_object *probj = zend_object_store_get_object(*property TSRMLS_CC); @@ -347,8 +363,9 @@ ZEND_API void zend_object_proxy_set(zval **property, zval *value TSRMLS_DC) zend_error(E_WARNING, "Cannot write property of object - no write handler defined"); } } +/* }}} */ -ZEND_API zval* zend_object_proxy_get(zval *property TSRMLS_DC) +ZEND_API zval* zend_object_proxy_get(zval *property TSRMLS_DC) /* {{{ */ { zend_proxy_object *probj = zend_object_store_get_object(property TSRMLS_CC); @@ -360,11 +377,13 @@ ZEND_API zval* zend_object_proxy_get(zval *property TSRMLS_DC) return NULL; } +/* }}} */ -ZEND_API zend_object_handlers *zend_get_std_object_handlers() +ZEND_API zend_object_handlers *zend_get_std_object_handlers() /* {{{ */ { return &std_object_handlers; } +/* }}} */ static zend_object_handlers zend_object_proxy_handlers = { ZEND_OBJECTS_STORE_HANDLERS, @@ -391,7 +410,6 @@ static zend_object_handlers zend_object_proxy_handlers = { NULL, /* count_elements */ }; - /* * Local variables: * tab-width: 4 diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 8455b16ab1..a646f270a7 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -31,26 +31,29 @@ extern int zend_spprintf(char **message, int max_len, char *format, ...); -static void zend_extension_op_array_ctor_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) +static void zend_extension_op_array_ctor_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) /* {{{ */ { if (extension->op_array_ctor) { extension->op_array_ctor(op_array); } } +/* }}} */ -static void zend_extension_op_array_dtor_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) +static void zend_extension_op_array_dtor_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) /* {{{ */ { if (extension->op_array_dtor) { extension->op_array_dtor(op_array); } } +/* }}} */ -static void op_array_alloc_ops(zend_op_array *op_array) +static void op_array_alloc_ops(zend_op_array *op_array) /* {{{ */ { op_array->opcodes = erealloc(op_array->opcodes, (op_array->size)*sizeof(zend_op)); } +/* }}} */ -void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size TSRMLS_DC) +void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size TSRMLS_DC) /* {{{ */ { op_array->type = type; @@ -106,8 +109,9 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_siz zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_ctor_handler, op_array TSRMLS_CC); } +/* }}} */ -ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC) +ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC) /* {{{ */ { switch (function->type) { case ZEND_USER_FUNCTION: @@ -118,15 +122,17 @@ ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC) break; } } +/* }}} */ -ZEND_API void zend_function_dtor(zend_function *function) +ZEND_API void zend_function_dtor(zend_function *function) /* {{{ */ { TSRMLS_FETCH(); destroy_zend_function(function TSRMLS_CC); } +/* }}} */ -ZEND_API void zend_u_function_dtor(zend_function *function) +ZEND_API void zend_u_function_dtor(zend_function *function) /* {{{ */ { TSRMLS_FETCH(); @@ -151,15 +157,17 @@ ZEND_API void zend_u_function_dtor(zend_function *function) } } } +/* }}} */ -static void zend_cleanup_op_array_data(zend_op_array *op_array) +static void zend_cleanup_op_array_data(zend_op_array *op_array) /* {{{ */ { if (op_array->static_variables) { zend_hash_clean(op_array->static_variables); } } +/* }}} */ -ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC) +ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC) /* {{{ */ { if (function->type == ZEND_USER_FUNCTION) { zend_cleanup_op_array_data((zend_op_array *) function); @@ -168,16 +176,18 @@ ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC) return ZEND_HASH_APPLY_STOP; } } +/* }}} */ -ZEND_API int zend_cleanup_function_data_full(zend_function *function TSRMLS_DC) +ZEND_API int zend_cleanup_function_data_full(zend_function *function TSRMLS_DC) /* {{{ */ { if (function->type == ZEND_USER_FUNCTION) { zend_cleanup_op_array_data((zend_op_array *) function); } return 0; } +/* }}} */ -ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC) +ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC) /* {{{ */ { if ((*pce)->type == ZEND_USER_CLASS) { /* Clean all parts that can contain run-time data */ @@ -196,8 +206,9 @@ ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC) } return 0; } +/* }}} */ -ZEND_API void destroy_zend_class(zend_class_entry **pce) +ZEND_API void destroy_zend_class(zend_class_entry **pce) /* {{{ */ { zend_class_entry *ce = *pce; @@ -237,13 +248,15 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce) break; } } +/* }}} */ -void zend_class_add_ref(zend_class_entry **ce) +void zend_class_add_ref(zend_class_entry **ce) /* {{{ */ { (*ce)->refcount++; } +/* }}} */ -ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC) +ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC) /* {{{ */ { zend_op *opline = op_array->opcodes; zend_op *end = op_array->opcodes+op_array->last; @@ -311,15 +324,17 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC) efree(op_array->arg_info); } } +/* }}} */ -void init_op(zend_op *op TSRMLS_DC) +void init_op(zend_op *op TSRMLS_DC) /* {{{ */ { memset(op, 0, sizeof(zend_op)); op->lineno = CG(zend_lineno); SET_UNUSED(op->result); } +/* }}} */ -zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC) +zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC) /* {{{ */ { zend_uint next_op_num = op_array->last++; zend_op *next_op; @@ -341,20 +356,23 @@ zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC) return next_op; } +/* }}} */ -int get_next_op_number(zend_op_array *op_array) +int get_next_op_number(zend_op_array *op_array) /* {{{ */ { return op_array->last; } +/* }}} */ -zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array) +zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array) /* {{{ */ { op_array->last_brk_cont++; op_array->brk_cont_array = erealloc(op_array->brk_cont_array, sizeof(zend_brk_cont_element)*op_array->last_brk_cont); return &op_array->brk_cont_array[op_array->last_brk_cont-1]; } +/* }}} */ -static void zend_update_extended_info(zend_op_array *op_array TSRMLS_DC) +static void zend_update_extended_info(zend_op_array *op_array TSRMLS_DC) /* {{{ */ { zend_op *opline = op_array->opcodes, *end=opline+op_array->last; @@ -376,15 +394,17 @@ static void zend_update_extended_info(zend_op_array *op_array TSRMLS_DC) opline++; } } +/* }}} */ -static void zend_extension_op_array_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) +static void zend_extension_op_array_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) /* {{{ */ { if (extension->op_array_handler) { extension->op_array_handler(op_array); } } +/* }}} */ -int pass_two(zend_op_array *op_array TSRMLS_DC) +int pass_two(zend_op_array *op_array TSRMLS_DC) /* {{{ */ { zend_op *opline, *end; @@ -438,8 +458,9 @@ int pass_two(zend_op_array *op_array TSRMLS_DC) op_array->done_pass_two = 1; return 0; } +/* }}} */ -int print_class(zend_class_entry *class_entry TSRMLS_DC) +int print_class(zend_class_entry *class_entry TSRMLS_DC) /* {{{ */ { char *tmp; @@ -452,8 +473,9 @@ int print_class(zend_class_entry *class_entry TSRMLS_DC) efree(tmp); return 0; } +/* }}} */ -ZEND_API unary_op_type get_unary_op(int opcode) +ZEND_API unary_op_type get_unary_op(int opcode) /* {{{ */ { switch (opcode) { case ZEND_BW_NOT: @@ -467,8 +489,9 @@ ZEND_API unary_op_type get_unary_op(int opcode) break; } } +/* }}} */ -ZEND_API void *get_binary_op(int opcode) +ZEND_API void *get_binary_op(int opcode) /* {{{ */ { switch (opcode) { case ZEND_ADD: @@ -538,6 +561,7 @@ ZEND_API void *get_binary_op(int opcode) break; } } +/* }}} */ /* * Local variables: diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index a8de2705c4..7b7960748c 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -45,7 +45,7 @@ static _locale_t current_locale = NULL; #define zend_tolower(c) tolower(c) #endif -ZEND_API int zend_atoi(const char *str, int str_len) +ZEND_API int zend_atoi(const char *str, int str_len) /* {{{ */ { int retval; @@ -71,9 +71,9 @@ ZEND_API int zend_atoi(const char *str, int str_len) } return retval; } +/* }}} */ - -ZEND_API double zend_string_to_double(const char *number, zend_uint length) +ZEND_API double zend_string_to_double(const char *number, zend_uint length) /* {{{ */ { double divisor = 10.0; double result = 0.0; @@ -117,9 +117,9 @@ ZEND_API double zend_string_to_double(const char *number, zend_uint length) } return result; } +/* }}} */ - -ZEND_API int convert_scalar_to_number(zval *op TSRMLS_DC) +ZEND_API int convert_scalar_to_number(zval *op TSRMLS_DC) /* {{{ */ { switch (Z_TYPE_P(op)) { case IS_STRING: @@ -175,7 +175,9 @@ ZEND_API int convert_scalar_to_number(zval *op TSRMLS_DC) return SUCCESS; } +/* }}} */ +/* {{{ zendi_convert_scalar_to_number */ #define zendi_convert_scalar_to_number(op, holder, result) \ if (op==result) { \ if (Z_TYPE_P(op) != IS_LONG) { \ @@ -233,6 +235,9 @@ ZEND_API int convert_scalar_to_number(zval *op TSRMLS_DC) } \ } +/* }}} */ + +/* {{{ DVAL_TO_LVAL */ #ifdef _WIN64 # define DVAL_TO_LVAL(d, l) \ if ((d) > LONG_MAX) { \ @@ -248,7 +253,9 @@ ZEND_API int convert_scalar_to_number(zval *op TSRMLS_DC) (l) = (long) (d); \ } #endif +/* }}} */ +/* {{{ zendi_convert_to_long */ #define zendi_convert_to_long(op, holder, result) \ if (op == result) { \ convert_to_long(op); \ @@ -287,7 +294,9 @@ ZEND_API int convert_scalar_to_number(zval *op TSRMLS_DC) (op) = &(holder); \ } +/* }}} */ +/* {{{ zendi_convert_to_boolean */ #define zendi_convert_to_boolean(op, holder, result) \ if (op==result) { \ convert_to_boolean(op); \ @@ -336,7 +345,9 @@ ZEND_API int convert_scalar_to_number(zval *op TSRMLS_DC) (op) = &(holder); \ } +/* }}} */ +/* {{{ convert_object_to_type */ #define convert_object_to_type(op, ctype, conv_func) \ if (Z_OBJ_HT_P(op)->cast_object) { \ zval dst; \ @@ -362,14 +373,15 @@ ZEND_API int convert_scalar_to_number(zval *op TSRMLS_DC) } \ } +/* }}} */ -ZEND_API int convert_to_long(zval *op) +ZEND_API int convert_to_long(zval *op) /* {{{ */ { return convert_to_long_base(op, 10); } +/* }}} */ - -ZEND_API int convert_to_long_base(zval *op, int base) +ZEND_API int convert_to_long_base(zval *op, int base) /* {{{ */ { long tmp; @@ -435,9 +447,9 @@ ZEND_API int convert_to_long_base(zval *op, int base) Z_TYPE_P(op) = IS_LONG; return SUCCESS; } +/* }}} */ - -ZEND_API int convert_to_double(zval *op) +ZEND_API int convert_to_double(zval *op) /* {{{ */ { double tmp; @@ -505,9 +517,9 @@ ZEND_API int convert_to_double(zval *op) Z_TYPE_P(op) = IS_DOUBLE; return SUCCESS; } +/* }}} */ - -ZEND_API int convert_to_null(zval *op) +ZEND_API int convert_to_null(zval *op) /* {{{ */ { if (Z_TYPE_P(op) == IS_OBJECT) { if (Z_OBJ_HT_P(op)->cast_object) { @@ -529,9 +541,9 @@ ZEND_API int convert_to_null(zval *op) Z_TYPE_P(op) = IS_NULL; return SUCCESS; } +/* }}} */ - -ZEND_API int convert_to_boolean(zval *op) +ZEND_API int convert_to_boolean(zval *op) /* {{{ */ { int tmp; @@ -608,11 +620,12 @@ ZEND_API int convert_to_boolean(zval *op) Z_TYPE_P(op) = IS_BOOL; return SUCCESS; } +/* }}} */ #define NUM_BUF_SIZE 512 /* rewrite of ap_php_conv_10 for UChar support */ -static UChar* zend_u_format_long(long lnum, UChar *result_end, int *result_len) +static UChar* zend_u_format_long(long lnum, UChar *result_end, int *result_len) /* {{{ */ { UChar *p = result_end; unsigned long magnitude; @@ -641,11 +654,12 @@ static UChar* zend_u_format_long(long lnum, UChar *result_end, int *result_len) *result_len = result_end - p - 1; return p; } +/* }}} */ #define NDIG 320 /* rewrite of ap_php_cvt for UChar support */ -static UChar* zend_u_format_double(double arg, int ndigits, int *decpt, int *sign, int eflag, UChar *buf) +static UChar* zend_u_format_double(double arg, int ndigits, int *decpt, int *sign, int eflag, UChar *buf) /* {{{ */ { register int r2; int mvl; @@ -734,9 +748,10 @@ static UChar* zend_u_format_double(double arg, int ndigits, int *decpt, int *sig *p = 0; return (buf); } +/* }}} */ /* rewrite of ap_php_gcvt for UChar support */ -static UChar* zend_u_format_gdouble(double dnum, int ndigit, UChar *result) +static UChar* zend_u_format_gdouble(double dnum, int ndigit, UChar *result) /* {{{ */ { int sign, decpt; register UChar *p1, *p2; @@ -842,13 +857,15 @@ static UChar* zend_u_format_gdouble(double dnum, int ndigit, UChar *result) *p2 = 0; return (result); } +/* }}} */ -ZEND_API int _convert_to_unicode(zval *op TSRMLS_DC ZEND_FILE_LINE_DC) +ZEND_API int _convert_to_unicode(zval *op TSRMLS_DC ZEND_FILE_LINE_DC) /* {{{ */ { return _convert_to_unicode_with_converter(op, ZEND_U_CONVERTER(UG(runtime_encoding_conv)) TSRMLS_CC ZEND_FILE_LINE_CC); } +/* }}} */ -ZEND_API int _convert_to_unicode_with_converter(zval *op, UConverter *conv TSRMLS_DC ZEND_FILE_LINE_DC) +ZEND_API int _convert_to_unicode_with_converter(zval *op, UConverter *conv TSRMLS_DC ZEND_FILE_LINE_DC) /* {{{ */ { switch (Z_TYPE_P(op)) { case IS_NULL: @@ -962,15 +979,16 @@ ZEND_API int _convert_to_unicode_with_converter(zval *op, UConverter *conv TSRML Z_TYPE_P(op) = IS_UNICODE; return SUCCESS; } +/* }}} */ - -ZEND_API int _convert_to_string(zval *op ZEND_FILE_LINE_DC) +ZEND_API int _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ { TSRMLS_FETCH(); return _convert_to_string_with_converter(op, ZEND_U_CONVERTER(UG(runtime_encoding_conv)) TSRMLS_CC ZEND_FILE_LINE_CC); } +/* }}} */ -ZEND_API int _convert_to_string_with_converter(zval *op, UConverter *conv TSRMLS_DC ZEND_FILE_LINE_DC) +ZEND_API int _convert_to_string_with_converter(zval *op, UConverter *conv TSRMLS_DC ZEND_FILE_LINE_DC) /* {{{ */ { long lval; double dval; @@ -1069,9 +1087,9 @@ ZEND_API int _convert_to_string_with_converter(zval *op, UConverter *conv TSRMLS Z_TYPE_P(op) = IS_STRING; return SUCCESS; } +/* }}} */ - -static int convert_scalar_to_array(zval *op, int type TSRMLS_DC) +static int convert_scalar_to_array(zval *op, int type TSRMLS_DC) /* {{{ */ { zval *entry; @@ -1099,9 +1117,9 @@ static int convert_scalar_to_array(zval *op, int type TSRMLS_DC) return SUCCESS; } +/* }}} */ - -ZEND_API int convert_to_array(zval *op) +ZEND_API int convert_to_array(zval *op) /* {{{ */ { TSRMLS_FETCH(); @@ -1149,9 +1167,9 @@ ZEND_API int convert_to_array(zval *op) return SUCCESS; } +/* }}} */ - -ZEND_API int convert_to_object(zval *op) +ZEND_API int convert_to_object(zval *op) /* {{{ */ { TSRMLS_FETCH(); switch (Z_TYPE_P(op)) { @@ -1176,8 +1194,9 @@ ZEND_API int convert_to_object(zval *op) return SUCCESS; } +/* }}} */ -ZEND_API void multi_convert_to_long_ex(int argc, ...) +ZEND_API void multi_convert_to_long_ex(int argc, ...) /* {{{ */ { zval **arg; va_list ap; @@ -1191,8 +1210,9 @@ ZEND_API void multi_convert_to_long_ex(int argc, ...) va_end(ap); } +/* }}} */ -ZEND_API void multi_convert_to_double_ex(int argc, ...) +ZEND_API void multi_convert_to_double_ex(int argc, ...) /* {{{ */ { zval **arg; va_list ap; @@ -1206,8 +1226,9 @@ ZEND_API void multi_convert_to_double_ex(int argc, ...) va_end(ap); } +/* }}} */ -ZEND_API void multi_convert_to_string_ex(int argc, ...) +ZEND_API void multi_convert_to_string_ex(int argc, ...) /* {{{ */ { zval **arg; va_list ap; @@ -1221,8 +1242,9 @@ ZEND_API void multi_convert_to_string_ex(int argc, ...) va_end(ap); } +/* }}} */ -ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; @@ -1275,9 +1297,9 @@ ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) zend_error(E_ERROR, "Unsupported operand types"); return FAILURE; /* unknown datatype */ } +/* }}} */ - -ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; @@ -1315,9 +1337,9 @@ ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) zend_error(E_ERROR, "Unsupported operand types"); return FAILURE; /* unknown datatype */ } +/* }}} */ - -ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; @@ -1347,8 +1369,9 @@ ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) zend_error(E_ERROR, "Unsupported operand types"); return FAILURE; /* unknown datatype */ } +/* }}} */ -ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; @@ -1386,9 +1409,9 @@ ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) zend_error(E_ERROR, "Unsupported operand types"); return FAILURE; /* unknown datatype */ } +/* }}} */ - -ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; @@ -1410,10 +1433,9 @@ ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) Z_LVAL_P(result) = Z_LVAL_P(op1) % Z_LVAL_P(op2); return SUCCESS; } +/* }}} */ - - -ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; @@ -1424,9 +1446,9 @@ ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) Z_LVAL_P(result) = Z_LVAL_P(op1) ^ Z_LVAL_P(op2); return SUCCESS; } +/* }}} */ - -ZEND_API int boolean_not_function(zval *result, zval *op1 TSRMLS_DC) +ZEND_API int boolean_not_function(zval *result, zval *op1 TSRMLS_DC) /* {{{ */ { zval op1_copy; @@ -1436,9 +1458,9 @@ ZEND_API int boolean_not_function(zval *result, zval *op1 TSRMLS_DC) Z_LVAL_P(result) = !Z_LVAL_P(op1); return SUCCESS; } +/* }}} */ - -ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) +ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) /* {{{ */ { zval op1_copy = *op1; @@ -1467,9 +1489,9 @@ ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) zend_error(E_ERROR, "Unsupported operand types"); return FAILURE; /* unknown datatype */ } +/* }}} */ - -ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; @@ -1510,9 +1532,9 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) Z_LVAL_P(result) = Z_LVAL_P(op1) | Z_LVAL_P(op2); return SUCCESS; } +/* }}} */ - -ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; @@ -1555,9 +1577,9 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) Z_LVAL_P(result) = Z_LVAL_P(op1) & Z_LVAL_P(op2); return SUCCESS; } +/* }}} */ - -ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; @@ -1600,9 +1622,9 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) Z_LVAL_P(result) = Z_LVAL_P(op1) ^ Z_LVAL_P(op2); return SUCCESS; } +/* }}} */ - -ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; @@ -1612,9 +1634,9 @@ ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) Z_TYPE_P(result) = IS_LONG; return SUCCESS; } +/* }}} */ - -ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; @@ -1624,10 +1646,10 @@ ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) Z_TYPE_P(result) = IS_LONG; return SUCCESS; } - +/* }}} */ /* must support result==op1 */ -ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2) +ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2) /* {{{ */ { if (Z_TYPE_P(op1) == IS_UNICODE) { UChar32 codepoint = (UChar32) Z_LVAL_P(op2); @@ -1653,10 +1675,10 @@ ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2) } return SUCCESS; } - +/* }}} */ /* must support result==op1 */ -ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2) +ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2) /* {{{ */ { assert(Z_TYPE_P(op1) == Z_TYPE_P(op2)); @@ -1679,9 +1701,9 @@ ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2) } return SUCCESS; } +/* }}} */ - -ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; int use_copy1 = 0, use_copy2 = 0; @@ -1738,9 +1760,9 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) } return SUCCESS; } +/* }}} */ - -ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; int use_copy1, use_copy2; @@ -1775,8 +1797,9 @@ ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_D } return SUCCESS; } +/* }}} */ -ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; int use_copy1, use_copy2; @@ -1812,8 +1835,9 @@ ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 T return SUCCESS; } +/* }}} */ -ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; @@ -1830,9 +1854,9 @@ ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_ return SUCCESS; } +/* }}} */ - -static inline void zend_free_obj_get_result(zval *op) +static inline void zend_free_obj_get_result(zval *op) /* {{{ */ { if (op) { if (op->refcount == 0) { @@ -1843,13 +1867,14 @@ static inline void zend_free_obj_get_result(zval *op) } } } +/* }}} */ #define COMPARE_RETURN_AND_FREE(retval) \ zend_free_obj_get_result(op1_free); \ zend_free_obj_get_result(op2_free); \ return retval; -ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; zval *op1_free, *op2_free; @@ -1984,9 +2009,9 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) ZVAL_BOOL(result, 0); COMPARE_RETURN_AND_FREE(FAILURE); } +/* }}} */ - -static int hash_zval_identical_function(const zval **z1, const zval **z2) +static int hash_zval_identical_function(const zval **z1, const zval **z2) /* {{{ */ { zval result; TSRMLS_FETCH(); @@ -2001,9 +2026,9 @@ static int hash_zval_identical_function(const zval **z1, const zval **z2) } return !Z_LVAL(result); } +/* }}} */ - -ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { Z_TYPE_P(result) = IS_BOOL; if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) { @@ -2058,9 +2083,9 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) } return SUCCESS; } +/* }}} */ - -ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { Z_TYPE_P(result) = IS_BOOL; if (is_identical_function(result, op1, op2 TSRMLS_CC) == FAILURE) { @@ -2069,9 +2094,9 @@ ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2 TSRMLS Z_LVAL_P(result) = !Z_LVAL_P(result); return SUCCESS; } +/* }}} */ - -ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { return FAILURE; @@ -2084,9 +2109,9 @@ ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) } return SUCCESS; } +/* }}} */ - -ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { return FAILURE; @@ -2099,9 +2124,9 @@ ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) } return SUCCESS; } +/* }}} */ - -ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { return FAILURE; @@ -2127,9 +2152,9 @@ ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) zend_error(E_ERROR, "Unsupported operand types"); return FAILURE; } +/* }}} */ - -ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) +ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { return FAILURE; @@ -2155,9 +2180,9 @@ ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSR zend_error(E_ERROR, "Unsupported operand types"); return FAILURE; } +/* }}} */ - -ZEND_API zend_bool instanceof_function_ex(zend_class_entry *instance_ce, zend_class_entry *ce, zend_bool interfaces_only TSRMLS_DC) +ZEND_API zend_bool instanceof_function_ex(zend_class_entry *instance_ce, zend_class_entry *ce, zend_bool interfaces_only TSRMLS_DC) /* {{{ */ { zend_uint i; @@ -2177,18 +2202,19 @@ ZEND_API zend_bool instanceof_function_ex(zend_class_entry *instance_ce, zend_cl return 0; } +/* }}} */ -ZEND_API zend_bool instanceof_function(zend_class_entry *instance_ce, zend_class_entry *ce TSRMLS_DC) +ZEND_API zend_bool instanceof_function(zend_class_entry *instance_ce, zend_class_entry *ce TSRMLS_DC) /* {{{ */ { return instanceof_function_ex(instance_ce, ce, 0 TSRMLS_CC); } +/* }}} */ #define LOWER_CASE 1 #define UPPER_CASE 2 #define NUMERIC 3 - -static void increment_string(zval *str) +static void increment_string(zval *str) /* {{{ */ { int carry=0; int pos=Z_STRLEN_P(str)-1; @@ -2263,8 +2289,9 @@ static void increment_string(zval *str) Z_STRVAL_P(str) = t; } } +/* }}} */ -static void increment_unicode(zval *str) +static void increment_unicode(zval *str) /* {{{ */ { int carry=0; int pos=Z_USTRLEN_P(str)-1; @@ -2340,8 +2367,9 @@ static void increment_unicode(zval *str) Z_USTRVAL_P(str) = t; } } +/* }}} */ -ZEND_API int increment_function(zval *op1) +ZEND_API int increment_function(zval *op1) /* {{{ */ { switch (Z_TYPE_P(op1)) { case IS_LONG: @@ -2423,9 +2451,9 @@ ZEND_API int increment_function(zval *op1) } return SUCCESS; } +/* }}} */ - -ZEND_API int decrement_function(zval *op1) +ZEND_API int decrement_function(zval *op1) /* {{{ */ { long lval; double dval; @@ -2498,22 +2526,24 @@ ZEND_API int decrement_function(zval *op1) return SUCCESS; } +/* }}} */ - -ZEND_API int zval_is_true(zval *op) +ZEND_API int zval_is_true(zval *op) /* {{{ */ { convert_to_boolean(op); return (Z_LVAL_P(op) ? 1 : 0); } +/* }}} */ #ifdef ZEND_USE_TOLOWER_L -ZEND_API void zend_update_current_locale() +ZEND_API void zend_update_current_locale() /* {{{ */ { current_locale = _get_current_locale(); } +/* }}} */ #endif -ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, unsigned int length) +ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, unsigned int length) /* {{{ */ { register unsigned char *str = (unsigned char*)source; register unsigned char *result = (unsigned char*)dest; @@ -2526,13 +2556,15 @@ ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, unsigned in return dest; } +/* }}} */ -ZEND_API char *zend_str_tolower_dup(const char *source, unsigned int length) +ZEND_API char *zend_str_tolower_dup(const char *source, unsigned int length) /* {{{ */ { return zend_str_tolower_copy((char *)emalloc(length+1), source, length); } +/* }}} */ -ZEND_API zstr zend_u_str_tolower_copy(zend_uchar type, zstr dest, zstr source, unsigned int length) +ZEND_API zstr zend_u_str_tolower_copy(zend_uchar type, zstr dest, zstr source, unsigned int length) /* {{{ */ { if (type == IS_UNICODE) { register UChar *str = source.u; @@ -2552,8 +2584,9 @@ ZEND_API zstr zend_u_str_tolower_copy(zend_uchar type, zstr dest, zstr source, u return ret; } } +/* }}} */ -ZEND_API zstr zend_u_str_tolower_dup(zend_uchar type, zstr source, unsigned int length) +ZEND_API zstr zend_u_str_tolower_dup(zend_uchar type, zstr source, unsigned int length) /* {{{ */ { zstr ret; @@ -2565,8 +2598,9 @@ ZEND_API zstr zend_u_str_tolower_dup(zend_uchar type, zstr source, unsigned int } return ret; } +/* }}} */ -ZEND_API void zend_str_tolower(char *str, unsigned int length) +ZEND_API void zend_str_tolower(char *str, unsigned int length) /* {{{ */ { register unsigned char *p = (unsigned char*)str; register unsigned char *end = p + length; @@ -2576,8 +2610,10 @@ ZEND_API void zend_str_tolower(char *str, unsigned int length) p++; } } +/* }}} */ -ZEND_API void zend_u_str_tolower(zend_uchar type, zstr str, unsigned int length) { +ZEND_API void zend_u_str_tolower(zend_uchar type, zstr str, unsigned int length) /* {{{ */ +{ if (type == IS_UNICODE) { register UChar *p = str.u; register UChar *end = p + length; @@ -2590,8 +2626,9 @@ ZEND_API void zend_u_str_tolower(zend_uchar type, zstr str, unsigned int length) zend_str_tolower(str.s, length); } } +/* }}} */ -ZEND_API zstr zend_u_str_case_fold(zend_uchar type, zstr source, unsigned int length, zend_bool normalize, unsigned int *new_len) +ZEND_API zstr zend_u_str_case_fold(zend_uchar type, zstr source, unsigned int length, zend_bool normalize, unsigned int *new_len) /* {{{ */ { zstr ret; @@ -2620,8 +2657,9 @@ ZEND_API zstr zend_u_str_case_fold(zend_uchar type, zstr source, unsigned int le } return ret; } +/* }}} */ -ZEND_API int zend_binary_strcmp(char *s1, uint len1, char *s2, uint len2) +ZEND_API int zend_binary_strcmp(char *s1, uint len1, char *s2, uint len2) /* {{{ */ { int retval; @@ -2632,16 +2670,16 @@ ZEND_API int zend_binary_strcmp(char *s1, uint len1, char *s2, uint len2) return retval; } } +/* }}} */ - -ZEND_API int zend_u_binary_strcmp(UChar *s1, int len1, UChar *s2, int len2) +ZEND_API int zend_u_binary_strcmp(UChar *s1, int len1, UChar *s2, int len2) /* {{{ */ { int result = u_strCompare(s1, len1, s2, len2, 1); return ZEND_NORMALIZE_BOOL(result); } +/* }}} */ - -ZEND_API int zend_binary_strncmp(char *s1, uint len1, char *s2, uint len2, uint length) +ZEND_API int zend_binary_strncmp(char *s1, uint len1, char *s2, uint len2, uint length) /* {{{ */ { int retval; @@ -2652,9 +2690,9 @@ ZEND_API int zend_binary_strncmp(char *s1, uint len1, char *s2, uint len2, uint return retval; } } +/* }}} */ - -ZEND_API int zend_u_binary_strncmp(UChar *s1, int len1, UChar *s2, int len2, uint length) +ZEND_API int zend_u_binary_strncmp(UChar *s1, int len1, UChar *s2, int len2, uint length) /* {{{ */ { int32_t off1 = 0, off2 = 0; UChar32 c1, c2; @@ -2675,9 +2713,9 @@ ZEND_API int zend_u_binary_strncmp(UChar *s1, int len1, UChar *s2, int len2, uin return 0; } +/* }}} */ - -ZEND_API int zend_binary_strcasecmp(char *s1, uint len1, char *s2, uint len2) +ZEND_API int zend_binary_strcasecmp(char *s1, uint len1, char *s2, uint len2) /* {{{ */ { int len; int c1, c2; @@ -2694,17 +2732,17 @@ ZEND_API int zend_binary_strcasecmp(char *s1, uint len1, char *s2, uint len2) return len1 - len2; } +/* }}} */ - -ZEND_API int zend_u_binary_strcasecmp(UChar *s1, int len1, UChar *s2, int len2) +ZEND_API int zend_u_binary_strcasecmp(UChar *s1, int len1, UChar *s2, int len2) /* {{{ */ { UErrorCode status = U_ZERO_ERROR; int result = u_strCaseCompare(s1, len1, s2, len2, U_COMPARE_CODE_POINT_ORDER, &status); return ZEND_NORMALIZE_BOOL(result); } +/* }}} */ - -ZEND_API int zend_binary_strncasecmp(char *s1, uint len1, char *s2, uint len2, uint length) +ZEND_API int zend_binary_strncasecmp(char *s1, uint len1, char *s2, uint len2, uint length) /* {{{ */ { int len; int c1, c2; @@ -2721,14 +2759,14 @@ ZEND_API int zend_binary_strncasecmp(char *s1, uint len1, char *s2, uint len2, u return MIN(length, len1) - MIN(length, len2); } - +/* }}} */ /* * Because we do not know UChar offsets for the passed-in limit of the number of * codepoints to compare, we take a hit upfront by iterating over both strings * until we find them. Then we can simply use u_strCaseCompare(). */ -ZEND_API int zend_u_binary_strncasecmp(UChar *s1, int len1, UChar *s2, int len2, uint length) +ZEND_API int zend_u_binary_strncasecmp(UChar *s1, int len1, UChar *s2, int len2, uint length) /* {{{ */ { UErrorCode status = U_ZERO_ERROR; int32_t off1 = 0, off2 = 0; @@ -2739,39 +2777,39 @@ ZEND_API int zend_u_binary_strncasecmp(UChar *s1, int len1, UChar *s2, int len2, result = u_strCaseCompare(s1, off1, s2, off2, U_COMPARE_CODE_POINT_ORDER, &status); return ZEND_NORMALIZE_BOOL(result); } +/* }}} */ - -ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2) +ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2) /* {{{ */ { return zend_binary_strcmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2)); } +/* }}} */ - -ZEND_API int zend_u_binary_zval_strcmp(zval *s1, zval *s2) +ZEND_API int zend_u_binary_zval_strcmp(zval *s1, zval *s2) /* {{{ */ { return zend_u_binary_strcmp(Z_USTRVAL_P(s1), Z_USTRLEN_P(s1), Z_USTRVAL_P(s2), Z_USTRLEN_P(s2)); } +/* }}} */ - -ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3) +ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3) /* {{{ */ { return zend_binary_strncmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3)); } +/* }}} */ - -ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2) +ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2) /* {{{ */ { return zend_binary_strcasecmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2)); } +/* }}} */ - -ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3) +ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3) /* {{{ */ { return zend_binary_strncasecmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3)); } +/* }}} */ - -ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) +ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */ { int ret1, ret2; long lval1, lval2; @@ -2804,9 +2842,9 @@ string_cmp: } return; } +/* }}} */ - -ZEND_API void zendi_u_smart_strcmp(zval *result, zval *s1, zval *s2) +ZEND_API void zendi_u_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */ { int ret1, ret2; long lval1, lval2; @@ -2859,9 +2897,9 @@ string_cmp: } return; } +/* }}} */ - -static int hash_zval_compare_function(const zval **z1, const zval **z2 TSRMLS_DC) +static int hash_zval_compare_function(const zval **z1, const zval **z2 TSRMLS_DC) /* {{{ */ { zval result; @@ -2870,28 +2908,28 @@ static int hash_zval_compare_function(const zval **z1, const zval **z2 TSRMLS_DC } return Z_LVAL(result); } +/* }}} */ -ZEND_API int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2 TSRMLS_DC) +ZEND_API int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2 TSRMLS_DC) /* {{{ */ { return zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC); } +/* }}} */ - - -ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC) +ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC) /* {{{ */ { Z_TYPE_P(result) = IS_LONG; Z_LVAL_P(result) = zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC); } +/* }}} */ - -ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC) +ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC) /* {{{ */ { zend_compare_symbol_tables(result, Z_ARRVAL_P(a1), Z_ARRVAL_P(a2) TSRMLS_CC); } +/* }}} */ - -ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC) +ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC) /* {{{ */ { Z_TYPE_P(result) = IS_LONG; @@ -2906,13 +2944,15 @@ ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC) Z_LVAL_P(result) = Z_OBJ_HT_P(o1)->compare_objects(o1, o2 TSRMLS_CC); } } +/* }}} */ -ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC) +ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC) /* {{{ */ { TSRMLS_FETCH(); op->value.str.len = zend_spprintf(&op->value.str.val, 0, "%.*G", (int) EG(precision), (double)op->value.dval); } +/* }}} */ /* * Local variables: diff --git a/Zend/zend_ptr_stack.c b/Zend/zend_ptr_stack.c index 2a539c2720..6c24096fd4 100644 --- a/Zend/zend_ptr_stack.c +++ b/Zend/zend_ptr_stack.c @@ -25,15 +25,15 @@ # include #endif -ZEND_API void zend_ptr_stack_init(zend_ptr_stack *stack) +ZEND_API void zend_ptr_stack_init(zend_ptr_stack *stack) /* {{{ */ { stack->top_element = stack->elements = (void **) emalloc(sizeof(void *)*PTR_STACK_BLOCK_SIZE); stack->max = PTR_STACK_BLOCK_SIZE; stack->top = 0; } +/* }}} */ - -ZEND_API void zend_ptr_stack_n_push(zend_ptr_stack *stack, int count, ...) +ZEND_API void zend_ptr_stack_n_push(zend_ptr_stack *stack, int count, ...) /* {{{ */ { va_list ptr; void *elem; @@ -49,9 +49,9 @@ ZEND_API void zend_ptr_stack_n_push(zend_ptr_stack *stack, int count, ...) } va_end(ptr); } +/* }}} */ - -ZEND_API void zend_ptr_stack_n_pop(zend_ptr_stack *stack, int count, ...) +ZEND_API void zend_ptr_stack_n_pop(zend_ptr_stack *stack, int count, ...) /* {{{ */ { va_list ptr; void **elem; @@ -65,18 +65,17 @@ ZEND_API void zend_ptr_stack_n_pop(zend_ptr_stack *stack, int count, ...) } va_end(ptr); } +/* }}} */ - - -ZEND_API void zend_ptr_stack_destroy(zend_ptr_stack *stack) +ZEND_API void zend_ptr_stack_destroy(zend_ptr_stack *stack) /* {{{ */ { if (stack->elements) { efree(stack->elements); } } +/* }}} */ - -ZEND_API void zend_ptr_stack_apply(zend_ptr_stack *stack, void (*func)(void *)) +ZEND_API void zend_ptr_stack_apply(zend_ptr_stack *stack, void (*func)(void *)) /* {{{ */ { int i = stack->top; @@ -84,9 +83,9 @@ ZEND_API void zend_ptr_stack_apply(zend_ptr_stack *stack, void (*func)(void *)) func(stack->elements[i]); } } +/* }}} */ - -ZEND_API void zend_ptr_stack_clean(zend_ptr_stack *stack, void (*func)(void *), zend_bool free_elements) +ZEND_API void zend_ptr_stack_clean(zend_ptr_stack *stack, void (*func)(void *), zend_bool free_elements) /* {{{ */ { zend_ptr_stack_apply(stack, func); if (free_elements) { @@ -99,12 +98,13 @@ ZEND_API void zend_ptr_stack_clean(zend_ptr_stack *stack, void (*func)(void *), stack->top = 0; stack->top_element = stack->elements; } +/* }}} */ - -ZEND_API int zend_ptr_stack_num_elements(zend_ptr_stack *stack) +ZEND_API int zend_ptr_stack_num_elements(zend_ptr_stack *stack) /* {{{ */ { return stack->top; } +/* }}} */ /* * Local variables: diff --git a/Zend/zend_qsort.c b/Zend/zend_qsort.c index 54f67bb5c9..c77cffd69e 100644 --- a/Zend/zend_qsort.c +++ b/Zend/zend_qsort.c @@ -19,12 +19,11 @@ /* $Id$ */ #include "zend.h" - #include #define QSORT_STACK_SIZE (sizeof(size_t) * CHAR_BIT) -static void _zend_qsort_swap(void *a, void *b, size_t siz) +static void _zend_qsort_swap(void *a, void *b, size_t siz) /* {{{ */ { register char *tmp_a_char; register char *tmp_b_char; @@ -52,8 +51,9 @@ static void _zend_qsort_swap(void *a, void *b, size_t siz) *tmp_b_char++ = t_c; } } +/* }}} */ -ZEND_API void zend_qsort(void *base, size_t nmemb, size_t siz, compare_func_t compare TSRMLS_DC) +ZEND_API void zend_qsort(void *base, size_t nmemb, size_t siz, compare_func_t compare TSRMLS_DC) /* {{{ */ { void *begin_stack[QSORT_STACK_SIZE]; void *end_stack[QSORT_STACK_SIZE]; @@ -116,6 +116,7 @@ ZEND_API void zend_qsort(void *base, size_t nmemb, size_t siz, compare_func_t co } } } +/* }}} */ /* * Local Variables: diff --git a/Zend/zend_sprintf.c b/Zend/zend_sprintf.c index 64fcb26fa2..705c276630 100644 --- a/Zend/zend_sprintf.c +++ b/Zend/zend_sprintf.c @@ -20,7 +20,6 @@ /* $Id$ */ #include - #include "zend.h" #ifdef HAVE_STDARG_H @@ -28,7 +27,7 @@ #endif #if ZEND_BROKEN_SPRINTF -int zend_sprintf(char *buffer, const char *format, ...) +int zend_sprintf(char *buffer, const char *format, ...) /* {{{ */ { va_list args; @@ -38,6 +37,7 @@ int zend_sprintf(char *buffer, const char *format, ...) return strlen(buffer); } +/* }}} */ #endif /* diff --git a/Zend/zend_stack.c b/Zend/zend_stack.c index 3729953082..d40aad5152 100644 --- a/Zend/zend_stack.c +++ b/Zend/zend_stack.c @@ -22,7 +22,7 @@ #include "zend.h" #include "zend_stack.h" -ZEND_API int zend_stack_init(zend_stack *stack) +ZEND_API int zend_stack_init(zend_stack *stack) /* {{{ */ { stack->top = 0; stack->elements = (void **) emalloc(sizeof(void **) * STACK_BLOCK_SIZE); @@ -33,8 +33,9 @@ ZEND_API int zend_stack_init(zend_stack *stack) return SUCCESS; } } +/* }}} */ -ZEND_API int zend_stack_push(zend_stack *stack, void *element, int size) +ZEND_API int zend_stack_push(zend_stack *stack, void *element, int size) /* {{{ */ { if (stack->top >= stack->max) { /* we need to allocate more memory */ stack->elements = (void **) erealloc(stack->elements, @@ -47,9 +48,9 @@ ZEND_API int zend_stack_push(zend_stack *stack, void *element, int size) memcpy(stack->elements[stack->top], element, size); return stack->top++; } +/* }}} */ - -ZEND_API int zend_stack_top(zend_stack *stack, void **element) +ZEND_API int zend_stack_top(zend_stack *stack, void **element) /* {{{ */ { if (stack->top > 0) { *element = stack->elements[stack->top - 1]; @@ -59,18 +60,18 @@ ZEND_API int zend_stack_top(zend_stack *stack, void **element) return FAILURE; } } +/* }}} */ - -ZEND_API int zend_stack_del_top(zend_stack *stack) +ZEND_API int zend_stack_del_top(zend_stack *stack) /* {{{ */ { if (stack->top > 0) { efree(stack->elements[--stack->top]); } return SUCCESS; } +/* }}} */ - -ZEND_API int zend_stack_int_top(zend_stack *stack) +ZEND_API int zend_stack_int_top(zend_stack *stack) /* {{{ */ { int *e; @@ -80,9 +81,9 @@ ZEND_API int zend_stack_int_top(zend_stack *stack) return *e; } } +/* }}} */ - -ZEND_API int zend_stack_is_empty(zend_stack *stack) +ZEND_API int zend_stack_is_empty(zend_stack *stack) /* {{{ */ { if (stack->top == 0) { return 1; @@ -90,9 +91,9 @@ ZEND_API int zend_stack_is_empty(zend_stack *stack) return 0; } } +/* }}} */ - -ZEND_API int zend_stack_destroy(zend_stack *stack) +ZEND_API int zend_stack_destroy(zend_stack *stack) /* {{{ */ { register int i; @@ -105,21 +106,21 @@ ZEND_API int zend_stack_destroy(zend_stack *stack) } return SUCCESS; } +/* }}} */ - -ZEND_API void **zend_stack_base(zend_stack *stack) +ZEND_API void **zend_stack_base(zend_stack *stack) /* {{{ */ { return stack->elements; } +/* }}} */ - -ZEND_API int zend_stack_count(zend_stack *stack) +ZEND_API int zend_stack_count(zend_stack *stack) /* {{{ */ { return stack->top; } +/* }}} */ - -ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function)(void *element)) +ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function)(void *element)) /* {{{ */ { int i; @@ -140,9 +141,9 @@ ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function break; } } +/* }}} */ - -ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg) +ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg) /* {{{ */ { int i; @@ -163,6 +164,7 @@ ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int type, int (* break; } } +/* }}} */ /* * Local variables: diff --git a/Zend/zend_static_allocator.c b/Zend/zend_static_allocator.c index b32f62ee84..90c209385e 100644 --- a/Zend/zend_static_allocator.c +++ b/Zend/zend_static_allocator.c @@ -22,13 +22,14 @@ /* Not checking emalloc() and erealloc() return values as they are supposed to bailout */ -inline static void block_init(Block *block, zend_uint block_size) +inline static void block_init(Block *block, zend_uint block_size) /* {{{ */ { block->pos = block->bp = (char *) emalloc(block_size); block->end = block->bp + block_size; } +/* }}} */ -inline static char *block_allocate(Block *block, zend_uint size) +inline static char *block_allocate(Block *block, zend_uint size) /* {{{ */ { char *retval = block->pos; if ((block->pos += size) >= block->end) { @@ -36,21 +37,24 @@ inline static char *block_allocate(Block *block, zend_uint size) } return retval; } +/* }}} */ -inline static void block_destroy(Block *block) +inline static void block_destroy(Block *block) /* {{{ */ { efree(block->bp); } +/* }}} */ -void static_allocator_init(StaticAllocator *sa) +void static_allocator_init(StaticAllocator *sa) /* {{{ */ { sa->Blocks = (Block *) emalloc(sizeof(Block)); block_init(sa->Blocks, ALLOCATOR_BLOCK_SIZE); sa->num_blocks = 1; sa->current_block = 0; } +/* }}} */ -char *static_allocator_allocate(StaticAllocator *sa, zend_uint size) +char *static_allocator_allocate(StaticAllocator *sa, zend_uint size) /* {{{ */ { char *retval; @@ -64,8 +68,9 @@ char *static_allocator_allocate(StaticAllocator *sa, zend_uint size) retval = block_allocate(&sa->Blocks[sa->current_block], size); return retval; } +/* }}} */ -void static_allocator_destroy(StaticAllocator *sa) +void static_allocator_destroy(StaticAllocator *sa) /* {{{ */ { zend_uint i; @@ -74,6 +79,7 @@ void static_allocator_destroy(StaticAllocator *sa) } efree(sa->Blocks); } +/* }}} */ /* * Local variables: diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c index 1d717b2bf3..8541c77e01 100644 --- a/Zend/zend_stream.c +++ b/Zend/zend_stream.c @@ -24,24 +24,26 @@ ZEND_DLIMPORT int isatty(int fd); -static size_t zend_stream_stdio_reader(void *handle, char *buf, size_t len TSRMLS_DC) +static size_t zend_stream_stdio_reader(void *handle, char *buf, size_t len TSRMLS_DC) /* {{{ */ { return fread(buf, 1, len, (FILE*)handle); } +/* }}} */ -static void zend_stream_stdio_closer(void *handle TSRMLS_DC) +static void zend_stream_stdio_closer(void *handle TSRMLS_DC) /* {{{ */ { if ((FILE*)handle != stdin) fclose((FILE*)handle); } +/* }}} */ -static long zend_stream_stdio_fteller(void *handle TSRMLS_DC) +static long zend_stream_stdio_fteller(void *handle TSRMLS_DC) /* {{{ */ { return ftell((FILE*) handle); } +/* }}} */ - -ZEND_API int zend_stream_open(const char *filename, zend_file_handle *handle TSRMLS_DC) +ZEND_API int zend_stream_open(const char *filename, zend_file_handle *handle TSRMLS_DC) /* {{{ */ { if (zend_stream_open_function) { return zend_stream_open_function(filename, handle TSRMLS_CC); @@ -54,8 +56,9 @@ ZEND_API int zend_stream_open(const char *filename, zend_file_handle *handle TSR return (handle->handle.fp) ? SUCCESS : FAILURE; } +/* }}} */ -ZEND_API int zend_stream_fixup(zend_file_handle *file_handle TSRMLS_DC) +ZEND_API int zend_stream_fixup(zend_file_handle *file_handle TSRMLS_DC) /* {{{ */ { switch (file_handle->type) { case ZEND_HANDLE_FILENAME: @@ -95,8 +98,9 @@ ZEND_API int zend_stream_fixup(zend_file_handle *file_handle TSRMLS_DC) } return SUCCESS; } +/* }}} */ -ZEND_API size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t len TSRMLS_DC) +ZEND_API size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t len TSRMLS_DC) /* {{{ */ { if (file_handle->handle.stream.interactive) { int c = '*'; @@ -120,8 +124,9 @@ ZEND_API size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_ } return file_handle->handle.stream.reader(file_handle->handle.stream.handle, buf, len TSRMLS_CC); } +/* }}} */ -ZEND_API int zend_stream_getc(zend_file_handle *file_handle TSRMLS_DC) +ZEND_API int zend_stream_getc(zend_file_handle *file_handle TSRMLS_DC) /* {{{ */ { char buf; @@ -130,13 +135,24 @@ ZEND_API int zend_stream_getc(zend_file_handle *file_handle TSRMLS_DC) } return EOF; } +/* }}} */ -ZEND_API int zend_stream_ferror(zend_file_handle *file_handle TSRMLS_DC) +ZEND_API int zend_stream_ferror(zend_file_handle *file_handle TSRMLS_DC) /* {{{ */ { return 0; } +/* }}} */ -ZEND_API long zend_stream_ftell(zend_file_handle *file_handle TSRMLS_DC) +ZEND_API long zend_stream_ftell(zend_file_handle *file_handle TSRMLS_DC) /* {{{ */ { return file_handle->handle.stream.fteller(file_handle->handle.stream.handle TSRMLS_CC); } +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + */ diff --git a/Zend/zend_strtod.c b/Zend/zend_strtod.c index a20e76bebd..411a4cd1e3 100644 --- a/Zend/zend_strtod.c +++ b/Zend/zend_strtod.c @@ -445,6 +445,7 @@ ZEND_API int zend_startup_strtod(void) /* {{{ */ return 1; } /* }}} */ + ZEND_API int zend_shutdown_strtod(void) /* {{{ */ { destroy_freelist(); diff --git a/Zend/zend_ts_hash.c b/Zend/zend_ts_hash.c index e59995dc27..9223a0c037 100644 --- a/Zend/zend_ts_hash.c +++ b/Zend/zend_ts_hash.c @@ -22,7 +22,7 @@ #include "zend_ts_hash.h" /* ts management functions */ -static void begin_read(TsHashTable *ht) +static void begin_read(TsHashTable *ht) /* {{{ */ { #ifdef ZTS tsrm_mutex_lock(ht->mx_reader); @@ -32,8 +32,9 @@ static void begin_read(TsHashTable *ht) tsrm_mutex_unlock(ht->mx_reader); #endif } +/* }}} */ -static void end_read(TsHashTable *ht) +static void end_read(TsHashTable *ht) /* {{{ */ { #ifdef ZTS tsrm_mutex_lock(ht->mx_reader); @@ -43,23 +44,26 @@ static void end_read(TsHashTable *ht) tsrm_mutex_unlock(ht->mx_reader); #endif } +/* }}} */ -static void begin_write(TsHashTable *ht) +static void begin_write(TsHashTable *ht) /* {{{ */ { #ifdef ZTS tsrm_mutex_lock(ht->mx_writer); #endif } +/* }}} */ -static void end_write(TsHashTable *ht) +static void end_write(TsHashTable *ht) /* {{{ */ { #ifdef ZTS tsrm_mutex_unlock(ht->mx_writer); #endif } +/* }}} */ /* delegates */ -ZEND_API int _zend_ts_hash_init(TsHashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC) +ZEND_API int _zend_ts_hash_init(TsHashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC) /* {{{ */ { #ifdef ZTS ht->mx_reader = tsrm_mutex_alloc(); @@ -68,8 +72,9 @@ ZEND_API int _zend_ts_hash_init(TsHashTable *ht, uint nSize, hash_func_t pHashFu #endif return _zend_hash_init(TS_HASH(ht), nSize, pHashFunction, pDestructor, persistent ZEND_FILE_LINE_RELAY_CC); } +/* }}} */ -ZEND_API int _zend_ts_hash_init_ex(TsHashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC) +ZEND_API int _zend_ts_hash_init_ex(TsHashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC) /* {{{ */ { #ifdef ZTS ht->mx_reader = tsrm_mutex_alloc(); @@ -78,8 +83,9 @@ ZEND_API int _zend_ts_hash_init_ex(TsHashTable *ht, uint nSize, hash_func_t pHas #endif return _zend_hash_init_ex(TS_HASH(ht), nSize, pHashFunction, pDestructor, persistent, bApplyProtection ZEND_FILE_LINE_RELAY_CC); } +/* }}} */ -ZEND_API void zend_ts_hash_destroy(TsHashTable *ht) +ZEND_API void zend_ts_hash_destroy(TsHashTable *ht) /* {{{ */ { begin_write(ht); zend_hash_destroy(TS_HASH(ht)); @@ -90,16 +96,18 @@ ZEND_API void zend_ts_hash_destroy(TsHashTable *ht) tsrm_mutex_free(ht->mx_writer); #endif } +/* }}} */ -ZEND_API void zend_ts_hash_clean(TsHashTable *ht) +ZEND_API void zend_ts_hash_clean(TsHashTable *ht) /* {{{ */ { ht->reader = 0; begin_write(ht); zend_hash_clean(TS_HASH(ht)); end_write(ht); } +/* }}} */ -ZEND_API int _zend_ts_hash_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) +ZEND_API int _zend_ts_hash_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) /* {{{ */ { int retval; @@ -109,8 +117,9 @@ ZEND_API int _zend_ts_hash_add_or_update(TsHashTable *ht, char *arKey, uint nKey return retval; } +/* }}} */ -ZEND_API int _zend_ts_hash_quick_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) +ZEND_API int _zend_ts_hash_quick_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) /* {{{ */ { int retval; @@ -120,8 +129,9 @@ ZEND_API int _zend_ts_hash_quick_add_or_update(TsHashTable *ht, char *arKey, uin return retval; } +/* }}} */ -ZEND_API int _zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) +ZEND_API int _zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) /* {{{ */ { int retval; @@ -131,8 +141,9 @@ ZEND_API int _zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, ulong h, return retval; } +/* }}} */ -ZEND_API int zend_ts_hash_add_empty_element(TsHashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_ts_hash_add_empty_element(TsHashTable *ht, char *arKey, uint nKeyLength) /* {{{ */ { int retval; @@ -142,8 +153,9 @@ ZEND_API int zend_ts_hash_add_empty_element(TsHashTable *ht, char *arKey, uint n return retval; } +/* }}} */ -ZEND_API void zend_ts_hash_graceful_destroy(TsHashTable *ht) +ZEND_API void zend_ts_hash_graceful_destroy(TsHashTable *ht) /* {{{ */ { begin_write(ht); zend_hash_graceful_destroy(TS_HASH(ht)); @@ -154,22 +166,25 @@ ZEND_API void zend_ts_hash_graceful_destroy(TsHashTable *ht) tsrm_mutex_free(ht->mx_reader); #endif } +/* }}} */ -ZEND_API void zend_ts_hash_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC) +ZEND_API void zend_ts_hash_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC) /* {{{ */ { begin_write(ht); zend_hash_apply(TS_HASH(ht), apply_func TSRMLS_CC); end_write(ht); } +/* }}} */ -ZEND_API void zend_ts_hash_apply_with_argument(TsHashTable *ht, apply_func_arg_t apply_func, void *argument TSRMLS_DC) +ZEND_API void zend_ts_hash_apply_with_argument(TsHashTable *ht, apply_func_arg_t apply_func, void *argument TSRMLS_DC) /* {{{ */ { begin_write(ht); zend_hash_apply_with_argument(TS_HASH(ht), apply_func, argument TSRMLS_CC); end_write(ht); } +/* }}} */ -ZEND_API void zend_ts_hash_apply_with_arguments(TsHashTable *ht, apply_func_args_t apply_func, int num_args, ...) +ZEND_API void zend_ts_hash_apply_with_arguments(TsHashTable *ht, apply_func_args_t apply_func, int num_args, ...) /* {{{ */ { va_list args; @@ -179,15 +194,17 @@ ZEND_API void zend_ts_hash_apply_with_arguments(TsHashTable *ht, apply_func_args end_write(ht); va_end(args); } +/* }}} */ -ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC) +ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC) /* {{{ */ { begin_write(ht); zend_hash_reverse_apply(TS_HASH(ht), apply_func TSRMLS_CC); end_write(ht); } +/* }}} */ -ZEND_API int zend_ts_hash_del_key_or_index(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag) +ZEND_API int zend_ts_hash_del_key_or_index(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag) /* {{{ */ { int retval; @@ -197,8 +214,9 @@ ZEND_API int zend_ts_hash_del_key_or_index(TsHashTable *ht, char *arKey, uint nK return retval; } +/* }}} */ -ZEND_API ulong zend_ts_get_hash_value(TsHashTable *ht, char *arKey, uint nKeyLength) +ZEND_API ulong zend_ts_get_hash_value(TsHashTable *ht, char *arKey, uint nKeyLength) /* {{{ */ { ulong retval; @@ -208,8 +226,9 @@ ZEND_API ulong zend_ts_get_hash_value(TsHashTable *ht, char *arKey, uint nKeyLen return retval; } +/* }}} */ -ZEND_API int zend_ts_hash_find(TsHashTable *ht, char *arKey, uint nKeyLength, void **pData) +ZEND_API int zend_ts_hash_find(TsHashTable *ht, char *arKey, uint nKeyLength, void **pData) /* {{{ */ { int retval; @@ -219,8 +238,9 @@ ZEND_API int zend_ts_hash_find(TsHashTable *ht, char *arKey, uint nKeyLength, vo return retval; } +/* }}} */ -ZEND_API int zend_ts_hash_quick_find(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData) +ZEND_API int zend_ts_hash_quick_find(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData) /* {{{ */ { int retval; @@ -230,8 +250,9 @@ ZEND_API int zend_ts_hash_quick_find(TsHashTable *ht, char *arKey, uint nKeyLeng return retval; } +/* }}} */ -ZEND_API int zend_ts_hash_index_find(TsHashTable *ht, ulong h, void **pData) +ZEND_API int zend_ts_hash_index_find(TsHashTable *ht, ulong h, void **pData) /* {{{ */ { int retval; @@ -241,8 +262,9 @@ ZEND_API int zend_ts_hash_index_find(TsHashTable *ht, ulong h, void **pData) return retval; } +/* }}} */ -ZEND_API int zend_ts_hash_exists(TsHashTable *ht, char *arKey, uint nKeyLength) +ZEND_API int zend_ts_hash_exists(TsHashTable *ht, char *arKey, uint nKeyLength) /* {{{ */ { int retval; @@ -252,8 +274,9 @@ ZEND_API int zend_ts_hash_exists(TsHashTable *ht, char *arKey, uint nKeyLength) return retval; } +/* }}} */ -ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, ulong h) +ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, ulong h) /* {{{ */ { int retval; @@ -263,8 +286,9 @@ ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, ulong h) return retval; } +/* }}} */ -ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size) +ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size) /* {{{ */ { begin_read(source); begin_write(target); @@ -272,8 +296,9 @@ ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_c end_write(target); end_read(source); } +/* }}} */ -ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite) +ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite) /* {{{ */ { begin_read(source); begin_write(target); @@ -281,8 +306,9 @@ ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ end_write(target); end_read(source); } +/* }}} */ -ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, uint size, merge_checker_func_t pMergeSource, void *pParam) +ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, uint size, merge_checker_func_t pMergeSource, void *pParam) /* {{{ */ { begin_read(source); begin_write(target); @@ -290,8 +316,9 @@ ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, co end_write(target); end_read(source); } +/* }}} */ -ZEND_API int zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber TSRMLS_DC) +ZEND_API int zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber TSRMLS_DC) /* {{{ */ { int retval; @@ -301,8 +328,9 @@ ZEND_API int zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, compare_f return retval; } +/* }}} */ -ZEND_API int zend_ts_hash_compare(TsHashTable *ht1, TsHashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC) +ZEND_API int zend_ts_hash_compare(TsHashTable *ht1, TsHashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC) /* {{{ */ { int retval; @@ -314,8 +342,9 @@ ZEND_API int zend_ts_hash_compare(TsHashTable *ht1, TsHashTable *ht2, compare_fu return retval; } +/* }}} */ -ZEND_API int zend_ts_hash_minmax(TsHashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC) +ZEND_API int zend_ts_hash_minmax(TsHashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC) /* {{{ */ { int retval; @@ -325,8 +354,9 @@ ZEND_API int zend_ts_hash_minmax(TsHashTable *ht, compare_func_t compar, int fla return retval; } +/* }}} */ -ZEND_API int zend_ts_hash_num_elements(TsHashTable *ht) +ZEND_API int zend_ts_hash_num_elements(TsHashTable *ht) /* {{{ */ { int retval; @@ -336,8 +366,9 @@ ZEND_API int zend_ts_hash_num_elements(TsHashTable *ht) return retval; } +/* }}} */ -ZEND_API int zend_ts_hash_rehash(TsHashTable *ht) +ZEND_API int zend_ts_hash_rehash(TsHashTable *ht) /* {{{ */ { int retval; @@ -347,21 +378,24 @@ ZEND_API int zend_ts_hash_rehash(TsHashTable *ht) return retval; } +/* }}} */ #if ZEND_DEBUG -void zend_ts_hash_display_pListTail(TsHashTable *ht) +void zend_ts_hash_display_pListTail(TsHashTable *ht) /* {{{ */ { begin_read(ht); zend_hash_display_pListTail(TS_HASH(ht)); end_read(ht); } +/* }}} */ -void zend_ts_hash_display(TsHashTable *ht) +void zend_ts_hash_display(TsHashTable *ht) /* {{{ */ { begin_read(ht); zend_hash_display(TS_HASH(ht)); end_read(ht); } +/* }}} */ #endif /* diff --git a/Zend/zend_unicode.c b/Zend/zend_unicode.c index 929ac20aa2..560a73bea5 100644 --- a/Zend/zend_unicode.c +++ b/Zend/zend_unicode.c @@ -813,7 +813,7 @@ void zend_register_unicode_exceptions(TSRMLS_D) } /* }}} */ -zend_collator* zend_collator_create(UCollator *coll) +zend_collator* zend_collator_create(UCollator *coll) /* {{{ */ { zend_collator *zcoll = NULL; @@ -823,8 +823,9 @@ zend_collator* zend_collator_create(UCollator *coll) return zcoll; } +/* }}} */ -void zend_collator_destroy(zend_collator *zcoll) +void zend_collator_destroy(zend_collator *zcoll) /* {{{ */ { zcoll->refcount--; if (zcoll->refcount == 0) { @@ -832,7 +833,7 @@ void zend_collator_destroy(zend_collator *zcoll) efree(zcoll); } } - +/* }}} */ /* * Local variables: diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index 967f7e96d6..a88d58dd12 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -26,8 +26,7 @@ #include "zend_constants.h" #include "zend_list.h" - -ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC) +ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC) /* {{{ */ { switch (Z_TYPE_P(zvalue) & ~IS_CONSTANT_INDEX) { case IS_CONSTANT: { @@ -78,9 +77,9 @@ dtor_unicode: break; } } +/* }}} */ - -ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC) +ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC) /* {{{ */ { switch (Z_TYPE_P(zvalue) & ~IS_CONSTANT_INDEX) { case IS_CONSTANT: { @@ -111,15 +110,15 @@ dtor_unicode: break; } } +/* }}} */ - -ZEND_API void zval_add_ref(zval **p) +ZEND_API void zval_add_ref(zval **p) /* {{{ */ { (*p)->refcount++; } +/* }}} */ - -ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC) +ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC) /* {{{ */ { switch (Z_TYPE_P(zvalue)) { case IS_RESOURCE: { @@ -170,42 +169,44 @@ copy_unicode: break; } } +/* }}} */ -ZEND_API int zend_print_variable(zval *var) +ZEND_API int zend_print_variable(zval *var) /* {{{ */ { return zend_print_zval(var, 0); } - +/* }}} */ #if ZEND_DEBUG -ZEND_API void _zval_copy_ctor_wrapper(zval *zvalue) +ZEND_API void _zval_copy_ctor_wrapper(zval *zvalue) /* {{{ */ { zval_copy_ctor(zvalue); } +/* }}} */ - -ZEND_API void _zval_dtor_wrapper(zval *zvalue) +ZEND_API void _zval_dtor_wrapper(zval *zvalue) /* {{{ */ { zval_dtor(zvalue); } +/* }}} */ - -ZEND_API void _zval_internal_dtor_wrapper(zval *zvalue) +ZEND_API void _zval_internal_dtor_wrapper(zval *zvalue) /* {{{ */ { zval_internal_dtor(zvalue); } +/* }}} */ - -ZEND_API void _zval_ptr_dtor_wrapper(zval **zval_ptr) +ZEND_API void _zval_ptr_dtor_wrapper(zval **zval_ptr) /* {{{ */ { zval_ptr_dtor(zval_ptr); } +/* }}} */ - -ZEND_API void _zval_internal_ptr_dtor_wrapper(zval **zval_ptr) +ZEND_API void _zval_internal_ptr_dtor_wrapper(zval **zval_ptr) /* {{{ */ { zval_internal_ptr_dtor(zval_ptr); } +/* }}} */ #endif /*