switch (Z_TYPE_P(expr)) {
case IS_ARRAY:
ZEND_PUTS("Array (");
- if (++Z_ARRVAL_P(expr)->nApplyCount>1) {
+ if (++Z_ARRVAL_P(expr)->u.v.nApplyCount>1) {
ZEND_PUTS(" *RECURSION*");
- Z_ARRVAL_P(expr)->nApplyCount--;
+ Z_ARRVAL_P(expr)->u.v.nApplyCount--;
return;
}
print_flat_hash(Z_ARRVAL_P(expr) TSRMLS_CC);
ZEND_PUTS(")");
- Z_ARRVAL_P(expr)->nApplyCount--;
+ Z_ARRVAL_P(expr)->u.v.nApplyCount--;
break;
case IS_OBJECT:
{
properties = Z_OBJPROP_P(expr);
}
if (properties) {
- if (++properties->nApplyCount>1) {
+ if (++properties->u.v.nApplyCount>1) {
ZEND_PUTS(" *RECURSION*");
- properties->nApplyCount--;
+ properties->u.v.nApplyCount--;
return;
}
print_flat_hash(properties TSRMLS_CC);
- properties->nApplyCount--;
+ properties->u.v.nApplyCount--;
}
ZEND_PUTS(")");
break;
switch (Z_TYPE_P(expr)) {
case IS_ARRAY:
ZEND_PUTS_EX("Array\n");
- if (++Z_ARRVAL_P(expr)->nApplyCount>1) {
+ if (++Z_ARRVAL_P(expr)->u.v.nApplyCount>1) {
ZEND_PUTS_EX(" *RECURSION*");
- Z_ARRVAL_P(expr)->nApplyCount--;
+ Z_ARRVAL_P(expr)->u.v.nApplyCount--;
return;
}
print_hash(write_func, Z_ARRVAL_P(expr), indent, 0 TSRMLS_CC);
- Z_ARRVAL_P(expr)->nApplyCount--;
+ Z_ARRVAL_P(expr)->u.v.nApplyCount--;
break;
case IS_OBJECT:
{
if ((properties = Z_OBJDEBUG_P(expr, is_temp)) == NULL) {
break;
}
- if (++properties->nApplyCount>1) {
+ if (++properties->u.v.nApplyCount>1) {
ZEND_PUTS_EX(" *RECURSION*");
- properties->nApplyCount--;
+ properties->u.v.nApplyCount--;
return;
}
print_hash(write_func, properties, indent, 1 TSRMLS_CC);
- properties->nApplyCount--;
+ properties->u.v.nApplyCount--;
if (is_temp) {
zend_hash_destroy(properties);
efree(properties);
compiler_globals->compiled_filename = NULL;
compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init_ex(compiler_globals->function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0);
+ zend_hash_init_ex(compiler_globals->function_table, 1024, NULL, ZEND_FUNCTION_DTOR, 1, 0);
zend_hash_copy(compiler_globals->function_table, global_function_table, function_copy_ctor);
compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init_ex(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
+ zend_hash_init_ex(compiler_globals->class_table, 64, NULL, ZEND_CLASS_DTOR, 1, 0);
zend_hash_copy(compiler_globals->class_table, global_class_table, zend_class_add_ref);
zend_set_default_compile_time_values(TSRMLS_C);
GLOBAL_AUTO_GLOBALS_TABLE = (HashTable *) malloc(sizeof(HashTable));
GLOBAL_CONSTANTS_TABLE = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init_ex(GLOBAL_FUNCTION_TABLE, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0);
- zend_hash_init_ex(GLOBAL_CLASS_TABLE, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
+ zend_hash_init_ex(GLOBAL_FUNCTION_TABLE, 1024, NULL, ZEND_FUNCTION_DTOR, 1, 0);
+ zend_hash_init_ex(GLOBAL_CLASS_TABLE, 64, NULL, ZEND_CLASS_DTOR, 1, 0);
zend_hash_init_ex(GLOBAL_AUTO_GLOBALS_TABLE, 8, NULL, auto_global_dtor, 1, 0);
- zend_hash_init_ex(GLOBAL_CONSTANTS_TABLE, 20, NULL, ZEND_CONSTANT_DTOR, 1, 0);
+ zend_hash_init_ex(GLOBAL_CONSTANTS_TABLE, 128, NULL, ZEND_CONSTANT_DTOR, 1, 0);
- zend_hash_init_ex(&module_registry, 50, NULL, module_destructor_zval, 1, 0);
+ zend_hash_init_ex(&module_registry, 32, NULL, module_destructor_zval, 1, 0);
zend_init_rsrc_list_dtors();
#ifdef ZTS
if (closure->debug_info == NULL) {
ALLOC_HASHTABLE(closure->debug_info);
- zend_hash_init(closure->debug_info, 1, NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_init(closure->debug_info, 8, NULL, ZVAL_PTR_DTOR, 0);
}
- if (closure->debug_info->nApplyCount == 0) {
+ if (closure->debug_info->u.v.nApplyCount == 0) {
if (closure->func.type == ZEND_USER_FUNCTION && closure->func.op_array.static_variables) {
HashTable *static_variables = closure->func.op_array.static_variables;
array_init(&val);
CG(current_import) = NULL;
CG(current_import_function) = NULL;
CG(current_import_const) = NULL;
- zend_hash_init(&CG(const_filenames), 0, NULL, NULL, 0);
+ zend_hash_init(&CG(const_filenames), 8, NULL, NULL, 0);
init_compiler_declarables(TSRMLS_C);
zend_stack_init(&CG(context_stack));
memset(&CG(context), 0, sizeof(CG(context)));
zend_init_compiler_data_structures(TSRMLS_C);
zend_init_rsrc_list(TSRMLS_C);
- zend_hash_init(&CG(filenames_table), 5, NULL, free_string_zval, 0);
+ zend_hash_init(&CG(filenames_table), 8, NULL, free_string_zval, 0);
zend_llist_init(&CG(open_files), sizeof(zend_file_handle), (void (*)(void *)) file_handle_dtor, 0);
CG(unclean_shutdown) = 0;
}
if (!CG(context).labels) {
ALLOC_HASHTABLE(CG(context).labels);
- zend_hash_init(CG(context).labels, 4, NULL, ptr_dtor, 0);
+ zend_hash_init(CG(context).labels, 8, NULL, ptr_dtor, 0);
}
dest.brk_cont = CG(context).current_brk_cont;
}
} else {
ALLOC_HASHTABLE(*overriden);
- zend_hash_init_ex(*overriden, 2, NULL, ptr_dtor, 0, 0);
+ zend_hash_init_ex(*overriden, 8, NULL, ptr_dtor, 0, 0);
}
fn = zend_hash_update_mem(*overriden, key, fn, sizeof(zend_function));
return;
HashTable exclude_table;
/* TODO: revisit this start size, may be its not optimal */
- zend_hash_init_ex(&exclude_table, 2, NULL, NULL, 0, 0);
+ zend_hash_init_ex(&exclude_table, 8, NULL, NULL, 0, 0);
zend_traits_compile_exclude_table(&exclude_table, ce->trait_precedences, ce->traits[i]);
CG(active_op_array)->scope->ce_flags |= ZEND_HAS_STATIC_IN_METHODS;
}
ALLOC_HASHTABLE(CG(active_op_array)->static_variables);
- zend_hash_init(CG(active_op_array)->static_variables, 2, NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_init(CG(active_op_array)->static_variables, 8, NULL, ZVAL_PTR_DTOR, 0);
}
zend_hash_update(CG(active_op_array)->static_variables, Z_STR(varname->u.constant), &tmp);
ce->default_properties_table = NULL;
ce->default_static_members_table = NULL;
- zend_hash_init_ex(&ce->properties_info, 0, NULL, (persistent_hashes ? zend_destroy_property_info_internal : zend_destroy_property_info), persistent_hashes, 0);
- zend_hash_init_ex(&ce->constants_table, 0, NULL, zval_ptr_dtor_func, persistent_hashes, 0);
- zend_hash_init_ex(&ce->function_table, 0, NULL, ZEND_FUNCTION_DTOR, persistent_hashes, 0);
+ zend_hash_init_ex(&ce->properties_info, 8, NULL, (persistent_hashes ? zend_destroy_property_info_internal : zend_destroy_property_info), persistent_hashes, 0);
+ zend_hash_init_ex(&ce->constants_table, 8, NULL, zval_ptr_dtor_func, persistent_hashes, 0);
+ zend_hash_init_ex(&ce->function_table, 8, NULL, ZEND_FUNCTION_DTOR, persistent_hashes, 0);
if (ce->type == ZEND_INTERNAL_CLASS) {
#ifdef ZTS
if (!CG(current_import)) {
CG(current_import) = emalloc(sizeof(HashTable));
- zend_hash_init(CG(current_import), 0, NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_init(CG(current_import), 8, NULL, ZVAL_PTR_DTOR, 0);
}
ZVAL_ZVAL(&ns, &ns_name->u.constant, 0, 0);
{
if (!CG(current_import_function)) {
CG(current_import_function) = emalloc(sizeof(HashTable));
- zend_hash_init(CG(current_import_function), 0, NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_init(CG(current_import_function), 8, NULL, ZVAL_PTR_DTOR, 0);
}
zend_do_use_non_class(ns_name, new_name, is_global, 1, 0, CG(current_import_function), CG(function_table) TSRMLS_CC);
{
if (!CG(current_import_const)) {
CG(current_import_const) = emalloc(sizeof(HashTable));
- zend_hash_init(CG(current_import_const), 0, NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_init(CG(current_import_const), 8, NULL, ZVAL_PTR_DTOR, 0);
}
zend_do_use_non_class(ns_name, new_name, is_global, 0, 1, CG(current_import_const), &CG(const_filenames) TSRMLS_CC);
{
EG(zend_constants) = (HashTable *) malloc(sizeof(HashTable));
- if (zend_hash_init(EG(zend_constants), 20, NULL, ZEND_CONSTANT_DTOR, 1)==FAILURE) {
- return FAILURE;
- }
+ zend_hash_init(EG(zend_constants), 128, NULL, ZEND_CONSTANT_DTOR, 1);
return SUCCESS;
}
ZVAL_LONG(&tmp, 0);
zend_vm_stack_push(&tmp TSRMLS_CC);
- zend_hash_init(&EG(symbol_table).ht, 50, NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_init(&EG(symbol_table).ht, 64, NULL, ZVAL_PTR_DTOR, 0);
EG(active_symbol_table) = &EG(symbol_table);
zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_activator TSRMLS_CC);
EG(opline_ptr) = NULL;
- zend_hash_init(&EG(included_files), 5, NULL, NULL, 0);
+ zend_hash_init(&EG(included_files), 8, NULL, NULL, 0);
EG(ticks_count) = 0;
if (EG(in_autoload) == NULL) {
ALLOC_HASHTABLE(EG(in_autoload));
- zend_hash_init(EG(in_autoload), 0, NULL, NULL, 0);
+ zend_hash_init(EG(in_autoload), 8, NULL, NULL, 0);
}
if (zend_hash_add_empty_element(EG(in_autoload), lc_name) == NULL) {
static void _zend_is_inconsistent(const HashTable *ht, const char *file, int line)
{
- if ((ht->flags & HASH_MASK_CONSISTENCY) == HT_OK) {
+ if ((ht->u.flags & HASH_MASK_CONSISTENCY) == HT_OK) {
return;
}
- switch ((ht->flags & HASH_MASK_CONSISTENCY)) {
+ switch ((ht->u.flags & HASH_MASK_CONSISTENCY)) {
case HT_IS_DESTROYING:
zend_output_debug_string(1, "%s(%d) : ht=%p is being destroyed", file, line, ht);
break;
}
#define IS_CONSISTENT(a) _zend_is_inconsistent(a, __FILE__, __LINE__);
#define SET_INCONSISTENT(n) do { \
- (ht)->flags |= n; \
+ (ht)->u.flags |= n; \
} while (0)
#else
#define IS_CONSISTENT(a)
#endif
#define HASH_PROTECT_RECURSION(ht) \
- if ((ht)->flags & HASH_FLAG_APPLY_PROTECTION) { \
- if ((ht)->nApplyCount++ >= 3) { \
- zend_error(E_ERROR, "Nesting level too deep - recursive dependency?"); \
+ if ((ht)->u.flags & HASH_FLAG_APPLY_PROTECTION) { \
+ if ((ht)->u.flags >= (3 << 8)) { \
+ zend_error_noreturn(E_ERROR, "Nesting level too deep - recursive dependency?");\
} \
+ (ht)->u.flags += (1 << 8); \
}
#define HASH_UNPROTECT_RECURSION(ht) \
- if ((ht)->flags & HASH_FLAG_APPLY_PROTECTION) { \
- (ht)->nApplyCount--; \
+ if ((ht)->u.flags & HASH_FLAG_APPLY_PROTECTION) { \
+ (ht)->u.flags -= (1 << 8); \
}
#define ZEND_HASH_IF_FULL_DO_RESIZE(ht) \
#define CHECK_INIT(ht, packed) do { \
if (UNEXPECTED((ht)->nTableMask == 0)) { \
if (packed) { \
- (ht)->arData = (Bucket *) safe_pemalloc((ht)->nTableSize, sizeof(Bucket), 0, (ht)->flags & HASH_FLAG_PERSISTENT); \
- (ht)->flags |= HASH_FLAG_PACKED; \
+ (ht)->arData = (Bucket *) safe_pemalloc((ht)->nTableSize, sizeof(Bucket), 0, (ht)->u.flags & HASH_FLAG_PERSISTENT); \
+ (ht)->u.flags |= HASH_FLAG_PACKED; \
} else { \
- (ht)->arData = (Bucket *) safe_pemalloc((ht)->nTableSize, sizeof(Bucket) + sizeof(zend_uint), 0, (ht)->flags & HASH_FLAG_PERSISTENT); \
+ (ht)->arData = (Bucket *) safe_pemalloc((ht)->nTableSize, sizeof(Bucket) + sizeof(zend_uint), 0, (ht)->u.flags & HASH_FLAG_PERSISTENT); \
(ht)->arHash = (zend_uint*)((ht)->arData + (ht)->nTableSize); \
memset((ht)->arHash, INVALID_IDX, (ht)->nTableSize * sizeof(zend_uint)); \
} \
static const zend_uint uninitialized_bucket = {INVALID_IDX};
-ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)
+ZEND_API void _zend_hash_init(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)
{
uint i = 3;
- ht->flags = 0;
SET_INCONSISTENT(HT_OK);
if (nSize >= 0x80000000) {
}
ht->nTableMask = 0; /* 0 means that ht->arBuckets is uninitialized */
- ht->pDestructor = pDestructor;
- ht->arData = NULL;
- ht->arHash = (zend_uint*)&uninitialized_bucket;
ht->nNumUsed = 0;
ht->nNumOfElements = 0;
ht->nNextFreeElement = 0;
+ ht->arData = NULL;
+ ht->arHash = (zend_uint*)&uninitialized_bucket;
+ ht->pDestructor = pDestructor;
ht->nInternalPointer = INVALID_IDX;
- ht->flags |= HASH_FLAG_APPLY_PROTECTION;
if (persistent) {
- ht->flags |= HASH_FLAG_PERSISTENT;
+ ht->u.flags = HASH_FLAG_PERSISTENT | HASH_FLAG_APPLY_PROTECTION;
+ } else {
+ ht->u.flags = HASH_FLAG_APPLY_PROTECTION;
}
- ht->nApplyCount = 0;
- return SUCCESS;
}
static void zend_hash_packed_grow(HashTable *ht)
{
HANDLE_BLOCK_INTERRUPTIONS();
- ht->arData = (Bucket *) safe_perealloc(ht->arData, (ht->nTableSize << 1), sizeof(Bucket), 0, ht->flags & HASH_FLAG_PERSISTENT);
+ ht->arData = (Bucket *) safe_perealloc(ht->arData, (ht->nTableSize << 1), sizeof(Bucket), 0, ht->u.flags & HASH_FLAG_PERSISTENT);
ht->nTableSize = (ht->nTableSize << 1);
ht->nTableMask = ht->nTableSize - 1;
HANDLE_UNBLOCK_INTERRUPTIONS();
ZEND_API void zend_hash_packed_to_hash(HashTable *ht)
{
HANDLE_BLOCK_INTERRUPTIONS();
- ht->flags &= ~HASH_FLAG_PACKED;
- ht->arData = (Bucket *) safe_perealloc(ht->arData, ht->nTableSize, sizeof(Bucket) + sizeof(zend_uint), 0, ht->flags & HASH_FLAG_PERSISTENT);
+ ht->u.flags &= ~HASH_FLAG_PACKED;
+ ht->arData = (Bucket *) safe_perealloc(ht->arData, ht->nTableSize, sizeof(Bucket) + sizeof(zend_uint), 0, ht->u.flags & HASH_FLAG_PERSISTENT);
ht->arHash = (zend_uint*)(ht->arData + ht->nTableSize);
zend_hash_rehash(ht);
HANDLE_UNBLOCK_INTERRUPTIONS();
ZEND_API void zend_hash_to_packed(HashTable *ht)
{
HANDLE_BLOCK_INTERRUPTIONS();
- ht->flags |= HASH_FLAG_PACKED;
+ ht->u.flags |= HASH_FLAG_PACKED;
ht->arData = erealloc(ht->arData, ht->nTableSize * sizeof(Bucket));
ht->arHash = (zend_uint*)&uninitialized_bucket;
HANDLE_UNBLOCK_INTERRUPTIONS();
}
-ZEND_API int _zend_hash_init_ex(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC)
+ZEND_API void _zend_hash_init_ex(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC)
{
- int retval = _zend_hash_init(ht, nSize, pDestructor, persistent ZEND_FILE_LINE_CC);
-
+ _zend_hash_init(ht, nSize, pDestructor, persistent ZEND_FILE_LINE_CC);
if (!bApplyProtection) {
- ht->flags &= ~HASH_FLAG_APPLY_PROTECTION;
+ ht->u.flags &= ~HASH_FLAG_APPLY_PROTECTION;
}
- return retval;
}
ZEND_API void zend_hash_set_apply_protection(HashTable *ht, zend_bool bApplyProtection)
{
if (bApplyProtection) {
- ht->flags |= HASH_FLAG_APPLY_PROTECTION;
+ ht->u.flags |= HASH_FLAG_APPLY_PROTECTION;
} else {
- ht->flags &= ~HASH_FLAG_APPLY_PROTECTION;
+ ht->u.flags &= ~HASH_FLAG_APPLY_PROTECTION;
}
}
IS_CONSISTENT(ht);
CHECK_INIT(ht, 0);
- if (ht->flags & HASH_FLAG_PACKED) {
+ if (ht->u.flags & HASH_FLAG_PACKED) {
zend_hash_packed_to_hash(ht);
}
ZEND_API zval *_zend_hash_str_add_or_update(HashTable *ht, const char *str, int len, zval *pData, int flag ZEND_FILE_LINE_DC)
{
- zend_string *key = STR_INIT(str, len, ht->flags & HASH_FLAG_PERSISTENT);
+ zend_string *key = STR_INIT(str, len, ht->u.flags & HASH_FLAG_PERSISTENT);
zval *ret = _zend_hash_add_or_update(ht, key, pData, flag ZEND_FILE_LINE_CC);
STR_RELEASE(key);
return ret;
}
CHECK_INIT(ht, h >= 0 && h < ht->nTableSize);
- if (ht->flags & HASH_FLAG_PACKED) {
+ if (ht->u.flags & HASH_FLAG_PACKED) {
if (EXPECTED(h >= 0)) {
if (h < ht->nNumUsed) {
p = ht->arData + h;
HANDLE_UNBLOCK_INTERRUPTIONS();
} else if ((ht->nTableSize << 1) > 0) { /* Let's double the table size */
HANDLE_BLOCK_INTERRUPTIONS();
- ht->arData = (Bucket *) safe_perealloc(ht->arData, (ht->nTableSize << 1), sizeof(Bucket) + sizeof(zend_uint), 0, ht->flags & HASH_FLAG_PERSISTENT);
+ ht->arData = (Bucket *) safe_perealloc(ht->arData, (ht->nTableSize << 1), sizeof(Bucket) + sizeof(zend_uint), 0, ht->u.flags & HASH_FLAG_PERSISTENT);
ht->arHash = (zend_uint*)(ht->arData + (ht->nTableSize << 1));
ht->nTableSize = (ht->nTableSize << 1);
ht->nTableMask = ht->nTableSize - 1;
static zend_always_inline void _zend_hash_del_el_ex(HashTable *ht, uint idx, Bucket *p, Bucket *prev)
{
- if (!(ht->flags & HASH_FLAG_PACKED)) {
+ if (!(ht->u.flags & HASH_FLAG_PACKED)) {
if (prev) {
Z_NEXT(prev->val) = Z_NEXT(p->val);
} else {
uint nIndex;
Bucket *prev = NULL;
- if (!(ht->flags & HASH_FLAG_PACKED)) {
+ if (!(ht->u.flags & HASH_FLAG_PACKED)) {
nIndex = p->h & ht->nTableMask;
idx = ht->arHash[nIndex];
if (p != ht->arData + idx) {
IS_CONSISTENT(ht);
- if (ht->flags & HASH_FLAG_PACKED) {
+ if (ht->u.flags & HASH_FLAG_PACKED) {
return FAILURE;
}
IS_CONSISTENT(ht);
- if (ht->flags & HASH_FLAG_PACKED) {
+ if (ht->u.flags & HASH_FLAG_PACKED) {
return FAILURE;
}
IS_CONSISTENT(ht);
- if (ht->flags & HASH_FLAG_PACKED) {
+ if (ht->u.flags & HASH_FLAG_PACKED) {
if (h >=0 && h < ht->nNumUsed) {
p = ht->arData + h;
if (Z_TYPE(p->val) != IS_UNDEF) {
}
}
if (ht->nTableMask) {
- pefree(ht->arData, ht->flags & HASH_FLAG_PERSISTENT);
+ pefree(ht->arData, ht->u.flags & HASH_FLAG_PERSISTENT);
}
SET_INCONSISTENT(HT_DESTROYED);
ht->nNextFreeElement = 0;
ht->nInternalPointer = INVALID_IDX;
if (ht->nTableMask) {
- if (!(ht->flags & HASH_FLAG_PACKED)) {
+ if (!(ht->u.flags & HASH_FLAG_PACKED)) {
memset(ht->arHash, INVALID_IDX, ht->nTableSize * sizeof(zend_uint));
}
}
zend_hash_apply_deleter(ht, idx, p);
}
if (ht->nTableMask) {
- pefree(ht->arData, ht->flags & HASH_FLAG_PERSISTENT);
+ pefree(ht->arData, ht->u.flags & HASH_FLAG_PERSISTENT);
}
SET_INCONSISTENT(HT_DESTROYED);
}
if (ht->nTableMask) {
- pefree(ht->arData, ht->flags & HASH_FLAG_PERSISTENT);
+ pefree(ht->arData, ht->u.flags & HASH_FLAG_PERSISTENT);
}
SET_INCONSISTENT(HT_DESTROYED);
IS_CONSISTENT(ht);
- if (ht->flags & HASH_FLAG_PACKED) {
+ if (ht->u.flags & HASH_FLAG_PACKED) {
return NULL;
}
IS_CONSISTENT(ht);
- if (ht->flags & HASH_FLAG_PACKED) {
+ if (ht->u.flags & HASH_FLAG_PACKED) {
return NULL;
}
IS_CONSISTENT(ht);
- if (ht->flags & HASH_FLAG_PACKED) {
+ if (ht->u.flags & HASH_FLAG_PACKED) {
return 0;
}
IS_CONSISTENT(ht);
- if (ht->flags & HASH_FLAG_PACKED) {
+ if (ht->u.flags & HASH_FLAG_PACKED) {
return 0;
}
IS_CONSISTENT(ht);
- if (ht->flags & HASH_FLAG_PACKED) {
+ if (ht->u.flags & HASH_FLAG_PACKED) {
if (h >= 0 && h < ht->nNumUsed) {
p = ht->arData + h;
if (Z_TYPE(p->val) != IS_UNDEF) {
IS_CONSISTENT(ht);
- if (ht->flags & HASH_FLAG_PACKED) {
+ if (ht->u.flags & HASH_FLAG_PACKED) {
if (h >= 0 && h < ht->nNumUsed) {
if (Z_TYPE(ht->arData[h].val) != IS_UNDEF) {
return 1;
return 0;
} else if (ht->nInternalPointer != ptr->pos) {
IS_CONSISTENT(ht);
- if (ht->flags & HASH_FLAG_PACKED) {
+ if (ht->u.flags & HASH_FLAG_PACKED) {
if (Z_TYPE(ht->arData[ptr->h].val) != IS_UNDEF) {
ht->nInternalPointer = ptr->h;
return 1;
if (renumber) {
ht->nNextFreeElement = i;
}
- if (ht->flags & HASH_FLAG_PACKED) {
+ if (ht->u.flags & HASH_FLAG_PACKED) {
if (!renumber) {
zend_hash_packed_to_hash(ht);
}
} else {
if (renumber) {
- ht->flags |= HASH_FLAG_PACKED;
+ ht->u.flags |= HASH_FLAG_PACKED;
ht->arData = erealloc(ht->arData, ht->nTableSize * sizeof(Bucket));
ht->arHash = (zend_uint*)&uninitialized_bucket;
} else {
BEGIN_EXTERN_C()
/* startup/shutdown */
-ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC);
-ZEND_API int _zend_hash_init_ex(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC);
+ZEND_API void _zend_hash_init(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC);
+ZEND_API void _zend_hash_init_ex(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC);
ZEND_API void zend_hash_destroy(HashTable *ht);
ZEND_API void zend_hash_clean(HashTable *ht);
#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent) _zend_hash_init((ht), (nSize), (pDestructor), (persistent) ZEND_FILE_LINE_CC)
END_EXTERN_C()
#define ZEND_INIT_SYMTABLE(ht) \
- ZEND_INIT_SYMTABLE_EX(ht, 2, 0)
+ ZEND_INIT_SYMTABLE_EX(ht, 8, 0)
#define ZEND_INIT_SYMTABLE_EX(ht, n, persistent) \
zend_hash_init(ht, n, NULL, ZVAL_PTR_DTOR, persistent)
{
void *p, *r;
- p = pemalloc(size, ht->flags & HASH_FLAG_PERSISTENT);
+ p = pemalloc(size, ht->u.flags & HASH_FLAG_PERSISTENT);
memcpy(p, pData, size);
if ((r = zend_hash_add_ptr(ht, key, p))) {
return r;
}
- pefree(p, ht->flags & HASH_FLAG_PERSISTENT);
+ pefree(p, ht->u.flags & HASH_FLAG_PERSISTENT);
return NULL;
}
{
void *p, *r;
- p = pemalloc(size, ht->flags & HASH_FLAG_PERSISTENT);
+ p = pemalloc(size, ht->u.flags & HASH_FLAG_PERSISTENT);
memcpy(p, pData, size);
if ((r = zend_hash_str_add_ptr(ht, str, len, p))) {
return r;
}
- pefree(p, ht->flags & HASH_FLAG_PERSISTENT);
+ pefree(p, ht->u.flags & HASH_FLAG_PERSISTENT);
return NULL;
}
{
void *p;
- p = pemalloc(size, ht->flags & HASH_FLAG_PERSISTENT);
+ p = pemalloc(size, ht->u.flags & HASH_FLAG_PERSISTENT);
memcpy(p, pData, size);
return zend_hash_update_ptr(ht, key, p);
}
{
void *p;
- p = pemalloc(size, ht->flags & HASH_FLAG_PERSISTENT);
+ p = pemalloc(size, ht->u.flags & HASH_FLAG_PERSISTENT);
memcpy(p, pData, size);
return zend_hash_str_update_ptr(ht, str, len, p);
}
{
void *p;
- p = pemalloc(size, ht->flags & HASH_FLAG_PERSISTENT);
+ p = pemalloc(size, ht->u.flags & HASH_FLAG_PERSISTENT);
memcpy(p, pData, size);
return zend_hash_index_update_ptr(ht, h, p);
}
{
void *p, *r;
- p = pemalloc(size, ht->flags & HASH_FLAG_PERSISTENT);
+ p = pemalloc(size, ht->u.flags & HASH_FLAG_PERSISTENT);
memcpy(p, pData, size);
if ((r = zend_hash_next_index_insert_ptr(ht, p))) {
return r;
}
- pefree(p, ht->flags & HASH_FLAG_PERSISTENT);
+ pefree(p, ht->u.flags & HASH_FLAG_PERSISTENT);
return NULL;
}
EG(ini_directives) = registered_zend_ini_directives;
EG(modified_ini_directives) = NULL;
EG(error_reporting_ini_entry) = NULL;
- if (zend_hash_init_ex(registered_zend_ini_directives, 100, NULL, _free_ptr, 1, 0) == FAILURE) {
- return FAILURE;
- }
+ zend_hash_init_ex(registered_zend_ini_directives, 128, NULL, _free_ptr, 1, 0);
return SUCCESS;
}
/* }}} */
EG(modified_ini_directives) = NULL;
EG(error_reporting_ini_entry) = NULL;
EG(ini_directives) = (HashTable *) malloc(sizeof(HashTable));
- if (zend_hash_init_ex(EG(ini_directives), registered_zend_ini_directives->nNumOfElements, NULL, NULL, 1, 0) == FAILURE) {
- return FAILURE;
- }
+ zend_hash_init_ex(EG(ini_directives), registered_zend_ini_directives->nNumOfElements, NULL, NULL, 1, 0);
zend_hash_copy(EG(ini_directives), registered_zend_ini_directives, NULL);
return SUCCESS;
}
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 */
- return SUCCESS;
- } else {
- return FAILURE;
- }
+ zend_hash_init(&EG(regular_list), 8, NULL, list_entry_destructor, 0);
+ return SUCCESS;
}
int zend_init_rsrc_plist(TSRMLS_D)
{
- return zend_hash_init_ex(&EG(persistent_list), 0, NULL, plist_entry_destructor, 1, 0);
+ zend_hash_init_ex(&EG(persistent_list), 8, NULL, plist_entry_destructor, 1, 0);
+ return SUCCESS;
}
{
int retval;
- retval = zend_hash_init(&list_destructors, 50, NULL, list_destructors_dtor, 1);
+ zend_hash_init(&list_destructors, 64, NULL, list_destructors_dtor, 1);
list_destructors.nNextFreeElement=1; /* we don't want resource type 0 */
-
- return retval;
+ return SUCCESS;
}
zend_class_entry *ce = zobj->ce;
ALLOC_HASHTABLE(zobj->properties);
- zend_hash_init(zobj->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_init(zobj->properties, 8, NULL, ZVAL_PTR_DTOR, 0);
if (ce->default_properties_count) {
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
if (/*prop_info->ce == ce &&*/
}
if (!zobj->guards) {
ALLOC_HASHTABLE(zobj->guards);
- zend_hash_init(zobj->guards, 0, NULL, NULL, 0);
+ zend_hash_init(zobj->guards, 8, NULL, NULL, 0);
} else if ((guard = zend_hash_find(zobj->guards, property_info->name)) != NULL) {
if (str) {
STR_RELEASE(str);
if (!new_object->properties) {
ALLOC_HASHTABLE(new_object->properties);
- zend_hash_init(new_object->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_init(new_object->properties, 8, NULL, ZVAL_PTR_DTOR, 0);
}
ZEND_HASH_FOREACH_KEY_VAL(old_object->properties, num_key, key, prop) {
switch (type) {
case IS_ARRAY:
ZVAL_NEW_ARR(op);
- zend_hash_init(Z_ARRVAL_P(op), 0, NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_init(Z_ARRVAL_P(op), 8, NULL, ZVAL_PTR_DTOR, 0);
zend_hash_index_update(Z_ARRVAL_P(op), 0, &entry);
break;
case IS_OBJECT:
zval arr;
ZVAL_NEW_ARR(&arr);
- zend_hash_init(Z_ARRVAL(arr), 0, NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_init(Z_ARRVAL(arr), 8, NULL, ZVAL_PTR_DTOR, 0);
if (Z_OBJCE_P(op) == zend_ce_closure) {
convert_scalar_to_array(op, IS_ARRAY TSRMLS_CC);
if (Z_TYPE_P(op) == IS_ARRAY) {
break;
case IS_NULL:
ZVAL_NEW_ARR(op);
- zend_hash_init(Z_ARRVAL_P(op), 0, NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_init(Z_ARRVAL_P(op), 8, NULL, ZVAL_PTR_DTOR, 0);
break;
default:
convert_scalar_to_array(op, IS_ARRAY TSRMLS_CC);
zend_string *str;
#ifndef ZTS
- zend_hash_init(&CG(interned_strings), 0, NULL, _str_dtor, 1);
+ zend_hash_init(&CG(interned_strings), 1024, NULL, _str_dtor, 1);
CG(interned_strings).nTableMask = CG(interned_strings).nTableSize - 1;
- CG(interned_strings).arData = (Bucket*) pecalloc(CG(interned_strings).nTableSize, sizeof(Bucket), CG(interned_strings).flags & HASH_FLAG_PERSISTENT);
- CG(interned_strings).arHash = (zend_uint*) pecalloc(CG(interned_strings).nTableSize, sizeof(zend_uint), CG(interned_strings).flags & HASH_FLAG_PERSISTENT);
+ CG(interned_strings).arData = (Bucket*) pecalloc(CG(interned_strings).nTableSize, sizeof(Bucket), 1);
+ CG(interned_strings).arHash = (zend_uint*) pecalloc(CG(interned_strings).nTableSize, sizeof(zend_uint), 1);
memset(CG(interned_strings).arHash, INVALID_IDX, CG(interned_strings).nTableSize * sizeof(zend_uint));
/* interned empty string */
if (CG(interned_strings).nNumUsed >= CG(interned_strings).nTableSize) {
if ((CG(interned_strings).nTableSize << 1) > 0) { /* Let's double the table size */
- Bucket *d = (Bucket *) perealloc_recoverable(CG(interned_strings).arData, (CG(interned_strings).nTableSize << 1) * sizeof(Bucket), CG(interned_strings).flags & HASH_FLAG_PERSISTENT);
- zend_uint *h = (zend_uint *) perealloc_recoverable(CG(interned_strings).arHash, (CG(interned_strings).nTableSize << 1) * sizeof(zend_uint), CG(interned_strings).flags & HASH_FLAG_PERSISTENT);
+ Bucket *d = (Bucket *) perealloc_recoverable(CG(interned_strings).arData, (CG(interned_strings).nTableSize << 1) * sizeof(Bucket), 1);
+ zend_uint *h = (zend_uint *) perealloc_recoverable(CG(interned_strings).arHash, (CG(interned_strings).nTableSize << 1) * sizeof(zend_uint), 1);
if (d && h) {
HANDLE_BLOCK_INTERRUPTIONS();
}
/* delegates */
-ZEND_API int _zend_ts_hash_init(TsHashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)
+ZEND_API void _zend_ts_hash_init(TsHashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)
{
#ifdef ZTS
ht->mx_reader = tsrm_mutex_alloc();
ht->mx_writer = tsrm_mutex_alloc();
ht->reader = 0;
#endif
- return _zend_hash_init(TS_HASH(ht), nSize, pDestructor, persistent ZEND_FILE_LINE_RELAY_CC);
+ _zend_hash_init(TS_HASH(ht), nSize, pDestructor, persistent ZEND_FILE_LINE_RELAY_CC);
}
-ZEND_API int _zend_ts_hash_init_ex(TsHashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC)
+ZEND_API void _zend_ts_hash_init_ex(TsHashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC)
{
#ifdef ZTS
ht->mx_reader = tsrm_mutex_alloc();
ht->mx_writer = tsrm_mutex_alloc();
ht->reader = 0;
#endif
- return _zend_hash_init_ex(TS_HASH(ht), nSize, pDestructor, persistent, bApplyProtection ZEND_FILE_LINE_RELAY_CC);
+ _zend_hash_init_ex(TS_HASH(ht), nSize, pDestructor, persistent, bApplyProtection ZEND_FILE_LINE_RELAY_CC);
}
ZEND_API void zend_ts_hash_destroy(TsHashTable *ht)
#define TS_HASH(table) (&(table->hash))
/* startup/shutdown */
-ZEND_API int _zend_ts_hash_init(TsHashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC);
-ZEND_API int _zend_ts_hash_init_ex(TsHashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC);
+ZEND_API void _zend_ts_hash_init(TsHashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC);
+ZEND_API void _zend_ts_hash_init_ex(TsHashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC);
ZEND_API void zend_ts_hash_destroy(TsHashTable *ht);
ZEND_API void zend_ts_hash_clean(TsHashTable *ht);
zend_uint *arHash;
dtor_func_t pDestructor;
zend_uint nInternalPointer;
- zend_uchar flags;
- zend_uchar nApplyCount;
+ union {
+ struct {
+ ZEND_ENDIAN_LOHI_3(
+ zend_uchar flags,
+ zend_uchar nApplyCount,
+ zend_ushort reserve)
+ } v;
+ zend_uint flags;
+ } u;
} HashTable;
struct _zend_array {
} zend_end_try();
EG(symbol_table).ht.pDestructor = old_destructor;
}
- zend_hash_init(&EG(symbol_table).ht, 0, NULL, NULL, 0);
+ zend_hash_init(&EG(symbol_table).ht, 8, NULL, NULL, 0);
old_destructor = EG(function_table)->pDestructor;
EG(function_table)->pDestructor = NULL;
zend_hash_reverse_apply(EG(function_table), (apply_func_t) accel_clean_non_persistent_function TSRMLS_CC);
zend_persistent_script *persistent_script = (zend_persistent_script *) emalloc(sizeof(zend_persistent_script));
memset(persistent_script, 0, sizeof(zend_persistent_script));
- zend_hash_init(&persistent_script->function_table, 100, NULL, (dtor_func_t) zend_accel_destroy_zend_function, 0);
+ zend_hash_init(&persistent_script->function_table, 128, NULL, (dtor_func_t) zend_accel_destroy_zend_function, 0);
/* class_table is usually destroyed by free_persistent_script() that
* overrides destructor. ZEND_CLASS_DTOR may be used by standard
* PHP compiler
*/
- zend_hash_init(&persistent_script->class_table, 10, NULL, ZEND_CLASS_DTOR, 0);
+ zend_hash_init(&persistent_script->class_table, 16, NULL, ZEND_CLASS_DTOR, 0);
return persistent_script;
}
Bucket *d;
Bucket *p;
- if (!ht->nNumOfElements || (ht->flags & HASH_FLAG_PACKED)) {
+ if (!ht->nNumOfElements || (ht->u.flags & HASH_FLAG_PACKED)) {
/* Empty tables don't allocate space for Buckets */
return 1;
}
return 1;
}
- d = (Bucket *)pemalloc(nSize * (sizeof(Bucket) + sizeof(zend_uint)), ht->flags & HASH_FLAG_PERSISTENT);
+ d = (Bucket *)pemalloc(nSize * (sizeof(Bucket) + sizeof(zend_uint)), ht->u.flags & HASH_FLAG_PERSISTENT);
if (!d) {
return 0;
}
}
ht->nNumUsed = j;
- pefree(ht->arData, ht->flags & HASH_FLAG_PERSISTENT);
+ pefree(ht->arData, ht->u.flags & HASH_FLAG_PERSISTENT);
ht->arData = d;
ht->arHash = (zend_uint *)(d + nSize);
ht->nNumOfElements = source->nNumOfElements;
ht->nNextFreeElement = source->nNextFreeElement;
ht->pDestructor = ZVAL_PTR_DTOR;
- ht->flags = HASH_FLAG_APPLY_PROTECTION;
+ ht->u.flags = HASH_FLAG_APPLY_PROTECTION;
ht->arData = NULL;
ht->arHash = NULL;
ht->nInternalPointer = source->nNumOfElements ? 0 : INVALID_IDX;
- ht->nApplyCount = 0;
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
if (!ht->nTableMask) {
}
#endif
- if (source->flags & HASH_FLAG_PACKED) {
- ht->flags |= HASH_FLAG_PACKED;
+ if (source->u.flags & HASH_FLAG_PACKED) {
+ ht->u.flags |= HASH_FLAG_PACKED;
ht->arData = (Bucket *) emalloc(ht->nTableSize * sizeof(Bucket));
ht->arHash = (zend_uint*)&uninitialized_bucket;
} else {
nIndex = p->h & ht->nTableMask;
/* Insert into hash collision list */
- if (source->flags & HASH_FLAG_PACKED) {
+ if (source->u.flags & HASH_FLAG_PACKED) {
Bucket *r = ht->arData + ht->nNumUsed;
q = ht->arData + p->h;
while (r != q) {
ht->nNumOfElements = source->nNumOfElements;
ht->nNextFreeElement = source->nNextFreeElement;
ht->pDestructor = ZEND_FUNCTION_DTOR;
- ht->flags = HASH_FLAG_APPLY_PROTECTION;
+ ht->u.flags = HASH_FLAG_APPLY_PROTECTION;
ht->nInternalPointer = source->nNumOfElements ? 0 : INVALID_IDX;
- ht->nApplyCount = 0;
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
if (!ht->nTableMask) {
}
#endif
- if (source->flags & HASH_FLAG_PACKED) {
- ht->flags |= HASH_FLAG_PACKED;
+ if (source->u.flags & HASH_FLAG_PACKED) {
+ ht->u.flags |= HASH_FLAG_PACKED;
ht->arData = (Bucket *) emalloc(ht->nTableSize * sizeof(Bucket));
ht->arHash = (zend_uint*)&uninitialized_bucket;
} else {
nIndex = p->h & ht->nTableMask;
/* Insert into hash collision list */
- if (source->flags & HASH_FLAG_PACKED) {
+ if (source->u.flags & HASH_FLAG_PACKED) {
Bucket *r = ht->arData + ht->nNumUsed;
q = ht->arData + p->h;
while (r != q) {
ht->nNumOfElements = source->nNumOfElements;
ht->nNextFreeElement = source->nNextFreeElement;
ht->pDestructor = zend_destroy_property_info;
- ht->flags = HASH_FLAG_APPLY_PROTECTION;
+ ht->u.flags = HASH_FLAG_APPLY_PROTECTION;
ht->nInternalPointer = source->nNumOfElements ? 0 : INVALID_IDX;
- ht->nApplyCount = 0;
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
if (!ht->nTableMask) {
}
#endif
- if (source->flags & HASH_FLAG_PACKED) {
+ if (source->u.flags & HASH_FLAG_PACKED) {
ht->arData = (Bucket *) emalloc(ht->nTableSize * sizeof(Bucket));
- ht->flags |= HASH_FLAG_PACKED;
+ ht->u.flags |= HASH_FLAG_PACKED;
ht->arHash = (zend_uint*)&uninitialized_bucket;
} else {
ht->arData = (Bucket *) emalloc(ht->nTableSize * (sizeof(Bucket) + sizeof(zend_uint)));
nIndex = p->h & ht->nTableMask;
/* Insert into hash collision list */
- if (source->flags & HASH_FLAG_PACKED) {
+ if (source->u.flags & HASH_FLAG_PACKED) {
Bucket *r = ht->arData + ht->nNumUsed;
q = ht->arData + p->h;
while (r != q) {
ht->arHash = (zend_uint*)&uninitialized_bucket;
return;
}
- if (ht->flags & HASH_FLAG_PACKED) {
+ if (ht->u.flags & HASH_FLAG_PACKED) {
zend_accel_store(ht->arData, sizeof(Bucket) * ht->nTableSize);
ht->arHash = (zend_uint*)&uninitialized_bucket;
} else {
if (!ht->nTableMask) {
RETURN_SIZE();
}
- if (ht->flags & HASH_FLAG_PACKED) {
+ if (ht->u.flags & HASH_FLAG_PACKED) {
ADD_DUP_SIZE(ht->arData, sizeof(Bucket) * ht->nTableSize);
} else {
ADD_DUP_SIZE(ht->arData, (sizeof(Bucket) + sizeof(zend_uint)) * ht->nTableSize);
* won't be taken from space which is freed by efree in memdup.
* Otherwise it leads to false matches in memdup check.
*/
- zend_hash_init(&xlat_table, 100, NULL, NULL, 1);
+ zend_hash_init(&xlat_table, 128, NULL, NULL, 1);
}
void zend_shared_alloc_unlock(TSRMLS_D)
/* IS_CONSISTENT(ht);*/
/* HASH_PROTECT_RECURSION(ht);*/
- if (ht->flags & HASH_FLAG_PACKED) {
+ if (ht->u.flags & HASH_FLAG_PACKED) {
if (intern->pos_h == intern->pos && Z_TYPE(ht->arData[intern->pos_h].val) != IS_UNDEF) {
return SUCCESS;
}
return &EG(uninitialized_zval);
}
- if ((type == BP_VAR_W || type == BP_VAR_RW) && (ht->nApplyCount > 0)) {
+ if ((type == BP_VAR_W || type == BP_VAR_RW) && (ht->u.v.nApplyCount > 0)) {
zend_error(E_WARNING, "Modification of ArrayObject during sorting is prohibited");
return &EG(error_zval);;
}
if (!offset) {
ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
- if (ht->nApplyCount > 0) {
+ if (ht->u.v.nApplyCount > 0) {
zend_error(E_WARNING, "Modification of ArrayObject during sorting is prohibited");
return;
}
switch (Z_TYPE_P(offset)) {
case IS_STRING:
ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
- if (ht->nApplyCount > 0) {
+ if (ht->u.v.nApplyCount > 0) {
zend_error(E_WARNING, "Modification of ArrayObject during sorting is prohibited");
return;
}
case IS_BOOL:
case IS_LONG:
ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
- if (ht->nApplyCount > 0) {
+ if (ht->u.v.nApplyCount > 0) {
zend_error(E_WARNING, "Modification of ArrayObject during sorting is prohibited");
return;
}
return;
case IS_NULL:
ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
- if (ht->nApplyCount > 0) {
+ if (ht->u.v.nApplyCount > 0) {
zend_error(E_WARNING, "Modification of ArrayObject during sorting is prohibited");
return;
}
switch(Z_TYPE_P(offset)) {
case IS_STRING:
ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
- if (ht->nApplyCount > 0) {
+ if (ht->u.v.nApplyCount > 0) {
zend_error(E_WARNING, "Modification of ArrayObject during sorting is prohibited");
return;
}
index = Z_LVAL_P(offset);
}
ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
- if (ht->nApplyCount > 0) {
+ if (ht->u.v.nApplyCount > 0) {
zend_error(E_WARNING, "Modification of ArrayObject during sorting is prohibited");
return;
}
ZEND_INIT_SYMTABLE_EX(intern->debug_info, zend_hash_num_elements(intern->std.properties) + 1, 0);
}
- if (intern->debug_info->nApplyCount == 0) {
+ if (intern->debug_info->u.v.nApplyCount == 0) {
zend_hash_clean(intern->debug_info);
zend_hash_copy(intern->debug_info, intern->std.properties, (copy_ctor_func_t) zval_add_ref);
*Z_ARRVAL(tmp) = *aht;
if (!use_arg) {
- aht->nApplyCount++;
+ aht->u.v.nApplyCount++;
zend_call_method(NULL, NULL, NULL, fname, fname_len, &retval, 1, &tmp, NULL TSRMLS_CC);
- aht->nApplyCount--;
+ aht->u.v.nApplyCount--;
} else if (use_arg == SPL_ARRAY_METHOD_MAY_USER_ARG) {
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "|z", &arg) == FAILURE) {
zval_ptr_dtor(&tmp);
zend_throw_exception(spl_ce_BadMethodCallException, "Function expects one argument at most", 0 TSRMLS_CC);
return;
}
- aht->nApplyCount++;
+ aht->u.v.nApplyCount++;
zend_call_method(NULL, NULL, NULL, fname, fname_len, &retval, arg? 2 : 1, &tmp, arg TSRMLS_CC);
- aht->nApplyCount--;
+ aht->u.v.nApplyCount--;
} else {
if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) {
zval_ptr_dtor(&tmp);
zend_throw_exception(spl_ce_BadMethodCallException, "Function expects exactly one argument", 0 TSRMLS_CC);
return;
}
- aht->nApplyCount++;
+ aht->u.v.nApplyCount++;
zend_call_method(NULL, NULL, NULL, fname, fname_len, &retval, 2, &tmp, arg TSRMLS_CC);
- aht->nApplyCount--;
+ aht->u.v.nApplyCount--;
}
/* A tricky way to pass "aht" by reference, copy back and cleanup */
if (Z_ISREF(tmp) && Z_TYPE_P(Z_REFVAL(tmp))) {
zend_hash_init(intern->debug_info, 1, NULL, ZVAL_PTR_DTOR, 0);
}
- if (intern->debug_info->nApplyCount == 0) {
+ if (intern->debug_info->u.v.nApplyCount == 0) {
if (!intern->std.properties) {
rebuild_object_properties(&intern->std);
ZEND_INIT_SYMTABLE_EX(intern->debug_info, zend_hash_num_elements(intern->std.properties) + 1, 0);
}
- if (intern->debug_info->nApplyCount == 0) {
+ if (intern->debug_info->u.v.nApplyCount == 0) {
zend_hash_copy(intern->debug_info, intern->std.properties, (copy_ctor_func_t) zval_add_ref);
ZEND_INIT_SYMTABLE_EX(intern->debug_info, zend_hash_num_elements(props) + 1, 0);
}
- if (intern->debug_info->nApplyCount == 0) {
+ if (intern->debug_info->u.v.nApplyCount == 0) {
zend_hash_copy(intern->debug_info, props, (copy_ctor_func_t)zval_add_ref);
array_init(&storage);
zval *element;
if (Z_TYPE_P(array) == IS_ARRAY) {
- if (Z_ARRVAL_P(array)->nApplyCount > 1) {
+ if (Z_ARRVAL_P(array)->u.v.nApplyCount > 1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected");
return 0;
}
cnt = zend_hash_num_elements(Z_ARRVAL_P(array));
if (mode == COUNT_RECURSIVE) {
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(array), element) {
- Z_ARRVAL_P(array)->nApplyCount++;
+ Z_ARRVAL_P(array)->u.v.nApplyCount++;
ZVAL_DEREF(element);
cnt += php_count_recursive(element, COUNT_RECURSIVE TSRMLS_CC);
- Z_ARRVAL_P(array)->nApplyCount--;
+ Z_ARRVAL_P(array)->u.v.nApplyCount--;
} ZEND_HASH_FOREACH_END();
}
}
SEPARATE_ZVAL(zv);
thash = Z_ARRVAL_P(zv);
}
- if (thash->nApplyCount > 1) {
+ if (thash->u.v.nApplyCount > 1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected");
if (userdata) {
zval_ptr_dtor(&args[2]);
orig_array_walk_fci = BG(array_walk_fci);
orig_array_walk_fci_cache = BG(array_walk_fci_cache);
- thash->nApplyCount++;
+ thash->u.v.nApplyCount++;
php_array_walk(thash, userdata, recursive TSRMLS_CC);
- thash->nApplyCount--;
+ thash->u.v.nApplyCount--;
/* restore the fcall info and cache */
BG(array_walk_fci) = orig_array_walk_fci;
zend_hash_update(Z_ARRVAL_P(return_value), Z_STR_P(entry), &data);
}
} else if (Z_TYPE_P(entry) == IS_ARRAY) {
- if ((Z_ARRVAL_P(entry)->nApplyCount > 1)) {
+ if ((Z_ARRVAL_P(entry)->u.v.nApplyCount > 1)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected");
return;
}
- Z_ARRVAL_P(entry)->nApplyCount++;
+ Z_ARRVAL_P(entry)->u.v.nApplyCount++;
ZEND_HASH_FOREACH_VAL_IND(Z_ARRVAL_P(entry), value_ptr) {
php_compact_var(eg_active_symbol_table, return_value, value_ptr TSRMLS_CC);
} ZEND_HASH_FOREACH_END();
- Z_ARRVAL_P(entry)->nApplyCount--;
+ Z_ARRVAL_P(entry)->u.v.nApplyCount--;
}
}
/* }}} */
p->key = NULL;
}
hash->nNextFreeElement = n_elems;
- if (!(hash->flags & HASH_FLAG_PACKED)) {
+ if (!(hash->u.flags & HASH_FLAG_PACKED)) {
zend_hash_to_packed(hash);
}
HANDLE_UNBLOCK_INTERRUPTIONS();
}
Z_ARRVAL_P(stack)->nNextFreeElement = k;
if (should_rehash) {
- if (Z_ARRVAL_P(stack)->flags & HASH_FLAG_PACKED) {
+ if (Z_ARRVAL_P(stack)->u.flags & HASH_FLAG_PACKED) {
zend_hash_packed_to_hash(Z_ARRVAL_P(stack));
} else {
zend_hash_rehash(Z_ARRVAL_P(stack));
ZVAL_DEREF(src_zval);
ZVAL_DEREF(dest_zval);
thash = Z_TYPE_P(dest_zval) == IS_ARRAY ? Z_ARRVAL_P(dest_zval) : NULL;
- if ((thash && thash->nApplyCount > 1) || (src_entry == dest_entry && Z_ISREF_P(dest_entry) && (Z_REFCOUNT_P(dest_entry) % 2))) {
+ if ((thash && thash->u.v.nApplyCount > 1) || (src_entry == dest_entry && Z_ISREF_P(dest_entry) && (Z_REFCOUNT_P(dest_entry) % 2))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected");
return 0;
}
}
if (Z_TYPE_P(src_zval) == IS_ARRAY) {
if (thash) {
- thash->nApplyCount++;
+ thash->u.v.nApplyCount++;
}
if (!php_array_merge(Z_ARRVAL_P(dest_zval), Z_ARRVAL_P(src_zval), recursive TSRMLS_CC)) {
if (thash) {
- thash->nApplyCount--;
+ thash->u.v.nApplyCount--;
}
return 0;
}
if (thash) {
- thash->nApplyCount--;
+ thash->u.v.nApplyCount--;
}
} else {
if (Z_REFCOUNTED_P(src_entry)) {
dest_zval = dest_entry;
ZVAL_DEREF(dest_zval);
- if (Z_ARRVAL_P(dest_zval)->nApplyCount > 1 ||
- Z_ARRVAL_P(src_zval)->nApplyCount > 1 ||
+ if (Z_ARRVAL_P(dest_zval)->u.v.nApplyCount > 1 ||
+ Z_ARRVAL_P(src_zval)->u.v.nApplyCount > 1 ||
(Z_ISREF_P(src_entry) && Z_ISREF_P(dest_entry) && Z_REF_P(src_entry) == Z_REF_P(dest_entry) && (Z_REFCOUNT_P(dest_entry) % 2))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected");
return 0;
}
SEPARATE_ZVAL(dest_zval);
- Z_ARRVAL_P(dest_zval)->nApplyCount++;
- Z_ARRVAL_P(src_zval)->nApplyCount++;
+ Z_ARRVAL_P(dest_zval)->u.v.nApplyCount++;
+ Z_ARRVAL_P(src_zval)->u.v.nApplyCount++;
if (!php_array_replace_recursive(Z_ARRVAL_P(dest_zval), Z_ARRVAL_P(src_zval) TSRMLS_CC)) {
- Z_ARRVAL_P(dest_zval)->nApplyCount--;
- Z_ARRVAL_P(src_zval)->nApplyCount--;
+ Z_ARRVAL_P(dest_zval)->u.v.nApplyCount--;
+ Z_ARRVAL_P(src_zval)->u.v.nApplyCount--;
return 0;
}
- Z_ARRVAL_P(dest_zval)->nApplyCount--;
- Z_ARRVAL_P(src_zval)->nApplyCount--;
+ Z_ARRVAL_P(dest_zval)->u.v.nApplyCount--;
+ Z_ARRVAL_P(src_zval)->u.v.nApplyCount--;
} ZEND_HASH_FOREACH_END();
return 1;
}
/* create and sort array with pointers to the target_hash buckets */
- arTmp = (struct bucketindex *) pemalloc((Z_ARRVAL_P(array)->nNumOfElements + 1) * sizeof(struct bucketindex), Z_ARRVAL_P(array)->flags & HASH_FLAG_PERSISTENT);
+ arTmp = (struct bucketindex *) pemalloc((Z_ARRVAL_P(array)->nNumOfElements + 1) * sizeof(struct bucketindex), Z_ARRVAL_P(array)->u.flags & HASH_FLAG_PERSISTENT);
if (!arTmp) {
zval_dtor(return_value);
RETURN_FALSE;
}
}
}
- pefree(arTmp, Z_ARRVAL_P(array)->flags & HASH_FLAG_PERSISTENT);
+ pefree(arTmp, Z_ARRVAL_P(array)->u.flags & HASH_FLAG_PERSISTENT);
}
/* }}} */
goto out;
}
hash = Z_ARRVAL(args[i]);
- list = (Bucket *) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket), hash->flags & HASH_FLAG_PERSISTENT);
+ list = (Bucket *) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket), hash->u.flags & HASH_FLAG_PERSISTENT);
if (!list) {
PHP_ARRAY_CMP_FUNC_RESTORE();
out:
for (i = 0; i < arr_argc; i++) {
hash = Z_ARRVAL(args[i]);
- pefree(lists[i], hash->flags & HASH_FLAG_PERSISTENT);
+ pefree(lists[i], hash->u.flags & HASH_FLAG_PERSISTENT);
}
PHP_ARRAY_CMP_FUNC_RESTORE();
goto out;
}
hash = Z_ARRVAL(args[i]);
- list = (Bucket *) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket), hash->flags & HASH_FLAG_PERSISTENT);
+ list = (Bucket *) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket), hash->u.flags & HASH_FLAG_PERSISTENT);
if (!list) {
PHP_ARRAY_CMP_FUNC_RESTORE();
out:
for (i = 0; i < arr_argc; i++) {
hash = Z_ARRVAL(args[i]);
- pefree(lists[i], hash->flags & HASH_FLAG_PERSISTENT);
+ pefree(lists[i], hash->u.flags & HASH_FLAG_PERSISTENT);
}
PHP_ARRAY_CMP_FUNC_RESTORE();
}
hash->nNextFreeElement = array_size;
- if (!(hash->flags & HASH_FLAG_PACKED)) {
+ if (!(hash->u.flags & HASH_FLAG_PACKED)) {
zend_hash_to_packed(hash);
}
}
BG(page_inode) = -1;
BG(page_mtime) = -1;
#ifdef HAVE_PUTENV
- if (zend_hash_init(&BG(putenv_ht), 1, NULL, php_putenv_destructor, 0) == FAILURE) {
- return FAILURE;
- }
+ zend_hash_init(&BG(putenv_ht), 1, NULL, php_putenv_destructor, 0);
#endif
BG(user_shutdown_function_names) = NULL;
static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_type, void *arg TSRMLS_DC) /* {{{ */
{
browser_data *bdata = arg;
- int persistent = bdata->htab->flags & HASH_FLAG_PERSISTENT;
+ int persistent = bdata->htab->u.flags & HASH_FLAG_PERSISTENT;
if (!arg1) {
return;
return FAILURE;
}
- if (zend_hash_init_ex(browdata->htab, 0, NULL,
+ zend_hash_init_ex(browdata->htab, 0, NULL,
(dtor_func_t) (persistent?browscap_entry_dtor_persistent
:browscap_entry_dtor_request),
- persistent, 0) == FAILURE) {
- pefree(browdata->htab, persistent);
- browdata->htab = NULL;
- return FAILURE;
- }
+ persistent, 0);
fh.handle.fp = VCWD_FOPEN(filename, "r");
fh.opened_path = NULL;
return FAILURE;
}
- if (ht->nApplyCount > 0) {
+ if (ht->u.v.nApplyCount > 0) {
/* Prevent recursion */
return SUCCESS;
}
*(p++) = 'B';
*p = '\0';
}
- ht->nApplyCount++;
+ ht->u.v.nApplyCount++;
php_url_encode_hash_ex(HASH_OF(zdata), formstr, NULL, 0, newprefix, newprefix_len, "%5D", 3, (Z_TYPE_P(zdata) == IS_OBJECT ? zdata : NULL), arg_sep, enc_type TSRMLS_CC);
- ht->nApplyCount--;
+ ht->u.v.nApplyCount--;
efree(newprefix);
} else if (Z_TYPE_P(zdata) == IS_NULL || Z_TYPE_P(zdata) == IS_RESOURCE) {
/* Skip these types */
/* fprintf(stderr, "SERIALIZE_INIT == lock: %u, level: %u\n", BG(serialize_lock), BG(serialize).level); */ \
if (BG(serialize_lock) || !BG(serialize).level) { \
ALLOC_HASHTABLE(var_hash_ptr); \
- zend_hash_init((var_hash_ptr), 10, NULL, NULL, 0); \
+ zend_hash_init((var_hash_ptr), 16, NULL, NULL, 0); \
if (!BG(serialize_lock)) { \
BG(serialize).var_hash = (void *)(var_hash_ptr); \
BG(serialize).level = 1; \
if (!BG(user_filter_map)) {
BG(user_filter_map) = (HashTable*) emalloc(sizeof(HashTable));
- zend_hash_init(BG(user_filter_map), 5, NULL, (dtor_func_t) filter_item_dtor, 0);
+ zend_hash_init(BG(user_filter_map), 8, NULL, (dtor_func_t) filter_item_dtor, 0);
}
fdat = ecalloc(1, sizeof(struct php_user_filter_data));
break;
case IS_ARRAY:
myht = Z_ARRVAL_P(struc);
- if (++myht->nApplyCount > 1) {
+ if (++myht->u.v.nApplyCount > 1) {
PUTS("*RECURSION*\n");
- --myht->nApplyCount;
+ --myht->u.v.nApplyCount;
return;
}
php_printf("%sarray(%d) {\n", COMMON, zend_hash_num_elements(myht));
goto head_done;
case IS_OBJECT:
myht = Z_OBJDEBUG_P(struc, is_temp);
- if (myht && ++myht->nApplyCount > 1) {
+ if (myht && ++myht->u.v.nApplyCount > 1) {
PUTS("*RECURSION*\n");
- --myht->nApplyCount;
+ --myht->u.v.nApplyCount;
return;
}
head_done:
if (myht) {
zend_hash_apply_with_arguments(myht TSRMLS_CC, (apply_func_args_t) php_element_dump_func, 1, level);
- --myht->nApplyCount;
+ --myht->u.v.nApplyCount;
if (is_temp) {
zend_hash_destroy(myht);
efree(myht);
break;
case IS_ARRAY:
myht = Z_ARRVAL_P(struc);
- if (myht->nApplyCount > 1) {
+ if (myht->u.v.nApplyCount > 1) {
PUTS("*RECURSION*\n");
return;
}
goto head_done;
case IS_OBJECT:
myht = Z_OBJDEBUG_P(struc, is_temp);
- if (myht && myht->nApplyCount > 1) {
+ if (myht && myht->u.v.nApplyCount > 1) {
PUTS("*RECURSION*\n");
return;
}
break;
case IS_ARRAY:
myht = Z_ARRVAL_P(struc);
- if (myht->nApplyCount > 0){
+ if (myht->u.v.nApplyCount > 0){
smart_str_appendl(buf, "NULL", 4);
zend_error(E_WARNING, "var_export does not handle circular references");
return;
case IS_OBJECT:
myht = Z_OBJPROP_P(struc);
- if(myht && myht->nApplyCount > 0){
+ if(myht && myht->u.v.nApplyCount > 0){
smart_str_appendl(buf, "NULL", 4);
zend_error(E_WARNING, "var_export does not handle circular references");
return;
/* we should still add element even if it's not OK,
* since we already wrote the length of the array before */
if ((Z_TYPE_P(data) == IS_ARRAY && Z_TYPE_P(struc) == IS_ARRAY && Z_ARR_P(data) == Z_ARR_P(struc))
- || (Z_TYPE_P(data) == IS_ARRAY && Z_ARRVAL_P(data)->nApplyCount > 1)
+ || (Z_TYPE_P(data) == IS_ARRAY && Z_ARRVAL_P(data)->u.v.nApplyCount > 1)
) {
smart_str_appendl(buf, "N;", 2);
} else {
if (Z_TYPE_P(data) == IS_ARRAY) {
- Z_ARRVAL_P(data)->nApplyCount++;
+ Z_ARRVAL_P(data)->u.v.nApplyCount++;
}
php_var_serialize_intern(buf, data, var_hash TSRMLS_CC);
if (Z_TYPE_P(data) == IS_ARRAY) {
- Z_ARRVAL_P(data)->nApplyCount--;
+ Z_ARRVAL_P(data)->u.v.nApplyCount--;
}
}
} ZEND_HASH_FOREACH_END();
static void sapi_globals_ctor(sapi_globals_struct *sapi_globals TSRMLS_DC)
{
memset(sapi_globals, 0, sizeof(*sapi_globals));
- zend_hash_init_ex(&sapi_globals->known_post_content_types, 5, NULL, _type_dtor, 1, 0);
+ zend_hash_init_ex(&sapi_globals->known_post_content_types, 8, NULL, _type_dtor, 1, 0);
php_setup_sapi_content_types(TSRMLS_C);
}
PHPAPI void php_output_startup(void)
{
ZEND_INIT_MODULE_GLOBALS(output, php_output_init_globals, NULL);
- zend_hash_init(&php_output_handler_aliases, 0, NULL, NULL, 1);
- zend_hash_init(&php_output_handler_conflicts, 0, NULL, NULL, 1);
- zend_hash_init(&php_output_handler_reverse_conflicts, 0, NULL, reverse_conflict_dtor, 1);
+ zend_hash_init(&php_output_handler_aliases, 8, NULL, NULL, 1);
+ zend_hash_init(&php_output_handler_conflicts, 8, NULL, NULL, 1);
+ zend_hash_init(&php_output_handler_reverse_conflicts, 8, NULL, reverse_conflict_dtor, 1);
php_output_direct = php_output_stdout;
}
/* }}} */
if (SUCCESS == (rev_ptr = zend_hash_str_find_ptr(&php_output_handler_reverse_conflicts, name, name_len))) {
return zend_hash_next_index_insert_ptr(rev_ptr, check_func) ? SUCCESS : FAILURE;
} else {
- zend_hash_init(&rev, 1, NULL, NULL, 1);
+ zend_hash_init(&rev, 8, NULL, NULL, 1);
if (SUCCESS != zend_hash_next_index_insert_ptr(&rev, check_func)) {
zend_hash_destroy(&rev);
return FAILURE;
/* If option not found in hash or is not an array -> create array, otherwise add to existing array */
if ((find_arr = zend_hash_find(active_hash, Z_STR_P(arg1))) == NULL || Z_TYPE_P(find_arr) != IS_ARRAY) {
ZVAL_NEW_PERSISTENT_ARR(&option_arr);
- zend_hash_init(Z_ARRVAL(option_arr), 0, NULL, (dtor_func_t) config_zval_dtor, 1);
+ zend_hash_init(Z_ARRVAL(option_arr), 8, NULL, (dtor_func_t) config_zval_dtor, 1);
find_arr = zend_hash_update(active_hash, Z_STR_P(arg1), &option_arr);
}
zval section_arr;
ZVAL_NEW_PERSISTENT_ARR(§ion_arr);
- zend_hash_init(Z_ARRVAL(section_arr), 0, NULL, (dtor_func_t) config_zval_dtor, 1);
+ zend_hash_init(Z_ARRVAL(section_arr), 8, NULL, (dtor_func_t) config_zval_dtor, 1);
entry = zend_hash_str_update(target_hash, key, key_len, §ion_arr);
}
active_ini_hash = Z_ARRVAL_P(entry);
int free_ini_search_path = 0;
zend_file_handle fh;
- if (zend_hash_init(&configuration_hash, 0, NULL, (dtor_func_t) config_zval_dtor, 1) == FAILURE) {
- return FAILURE;
- }
+ zend_hash_init(&configuration_hash, 8, NULL, (dtor_func_t) config_zval_dtor, 1);
if (sapi_module.ini_defaults) {
sapi_module.ini_defaults(&configuration_hash);
}
/* Initialize $_FILES[] */
- zend_hash_init(&PG(rfc1867_protected_variables), 5, NULL, NULL, 0);
+ zend_hash_init(&PG(rfc1867_protected_variables), 8, NULL, NULL, 0);
ALLOC_HASHTABLE(uploaded_files);
- zend_hash_init(uploaded_files, 5, NULL, free_filename, 0);
+ zend_hash_init(uploaded_files, 8, NULL, free_filename, 0);
SG(rfc1867_uploaded_files) = uploaded_files;
array_init(&PG(http_globals)[TRACK_VARS_FILES]);
/* Filters are cleaned up by the streams they're attached to */
le_stream_filter = zend_register_list_destructors_ex(NULL, NULL, "stream filter", module_number);
- return (
- zend_hash_init(&url_stream_wrappers_hash, 0, NULL, NULL, 1) == SUCCESS
- &&
- zend_hash_init(php_get_stream_filters_hash_global(), 0, NULL, NULL, 1) == SUCCESS
- &&
- zend_hash_init(php_stream_xport_get_hash(), 0, NULL, NULL, 1) == SUCCESS
- &&
- php_stream_xport_register("tcp", php_stream_generic_socket_factory TSRMLS_CC) == SUCCESS
+ zend_hash_init(&url_stream_wrappers_hash, 8, NULL, NULL, 1);
+ zend_hash_init(php_get_stream_filters_hash_global(), 8, NULL, NULL, 1);
+ zend_hash_init(php_stream_xport_get_hash(), 8, NULL, NULL, 1);
+
+ return (php_stream_xport_register("tcp", php_stream_generic_socket_factory TSRMLS_CC) == SUCCESS
&&
php_stream_xport_register("udp", php_stream_generic_socket_factory TSRMLS_CC) == SUCCESS
#if defined(AF_UNIX) && !(defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE))
{
HashTable sorted_registry;
- zend_hash_init(&sorted_registry, 50, NULL, NULL, 1);
+ zend_hash_init(&sorted_registry, 64, NULL, NULL, 1);
//??? zend_hash_copy(&sorted_registry, &module_registry, NULL, &tmp, sizeof(zend_module_entry));
zend_hash_copy(&sorted_registry, &module_registry, NULL);
zend_hash_sort(&sorted_registry, zend_qsort, module_name_cmp, 0 TSRMLS_CC);
new_entry = pemalloc(sizeof(user_config_cache_entry), 1);
new_entry->expires = 0;
new_entry->user_config = (HashTable *) pemalloc(sizeof(HashTable), 1);
- zend_hash_init(new_entry->user_config, 0, NULL, (dtor_func_t) config_zval_dtor, 1);
+ zend_hash_init(new_entry->user_config, 8, NULL, (dtor_func_t) config_zval_dtor, 1);
entry = zend_hash_str_update_ptr(&CGIG(user_config_cache), path, path_len, new_entry);
}
#ifdef PHP_WIN32
php_cgi_globals->impersonate = 0;
#endif
- zend_hash_init(&php_cgi_globals->user_config_cache, 0, NULL, (dtor_func_t) user_config_cache_entry_dtor, 1);
+ zend_hash_init(&php_cgi_globals->user_config_cache, 8, NULL, (dtor_func_t) user_config_cache_entry_dtor, 1);
}
/* }}} */
sa_t sa;
socklen_t len = sizeof(sa);
#endif
- zend_hash_init(&fcgi_mgmt_vars, 0, NULL, fcgi_free_mgmt_var_cb, 1);
+ zend_hash_init(&fcgi_mgmt_vars, 8, NULL, fcgi_free_mgmt_var_cb, 1);
fcgi_set_mgmt_var("FCGI_MPXS_CONNS", sizeof("FCGI_MPXS_CONNS")-1, "0", sizeof("0")-1);
is_initialized = 1;