/* {{{ get_debug_info handler for BreakIterator */
static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp TSRMLS_DC)
{
- zval zv;
+ zval val;
+ HashTable *debug_info;
BreakIterator_object *bio;
const BreakIterator *biter;
*is_temp = 1;
- array_init_size(&zv, 8);
+ ALLOC_HASHTABLE(debug_info);
+ zend_hash_init(debug_info, 8, NULL, ZVAL_PTR_DTOR, 0);
bio = Z_INTL_BREAKITERATOR_P(object);
biter = bio->biter;
if (biter == NULL) {
- add_assoc_bool_ex(&zv, "valid", sizeof("valid") - 1, 0);
- return Z_ARRVAL(zv);
+ ZVAL_FALSE(&val);
+ zend_hash_str_update(debug_info, "valid", sizeof("valid") - 1, &val);
+ return debug_info;
}
- add_assoc_bool_ex(&zv, "valid", sizeof("valid") - 1, 1);
+ ZVAL_TRUE(&val);
+ zend_hash_str_update(debug_info, "valid", sizeof("valid") - 1, &val);
if (Z_ISUNDEF(bio->text)) {
- add_assoc_null_ex(&zv, "text", sizeof("text") - 1);
+ ZVAL_NULL(&val);
+ zend_hash_str_update(debug_info, "text", sizeof("text") - 1, &val);
} else {
Z_TRY_ADDREF(bio->text);
- add_assoc_zval_ex(&zv, "text", sizeof("text") - 1, &bio->text);
+ zend_hash_str_update(debug_info, "text", sizeof("text") - 1, &bio->text);
}
- add_assoc_string_ex(&zv, "type", sizeof("type") - 1,
- const_cast<char*>(typeid(*biter).name()));
+ ZVAL_STRING(&val, const_cast<char*>(typeid(*biter).name()));
+ zend_hash_str_update(debug_info, "type", sizeof("type") - 1, &bio->text);
- return Z_ARRVAL(zv);
+ return debug_info;
}
/* }}} */
zfields;
Calendar_object *co;
const Calendar *cal;
+ HashTable *debug_info;
*is_temp = 1;
- array_init_size(&zv, 8);
+ ALLOC_HASHTABLE(debug_info);
+ zend_hash_init(debug_info, 8, NULL, ZVAL_PTR_DTOR, 0);
co = Z_INTL_CALENDAR_P(object);
cal = co->ucal;
if (cal == NULL) {
- add_assoc_bool_ex(&zv, "valid", sizeof("valid"), 0);
- return Z_ARRVAL(zv);
+ ZVAL_FALSE(&zv);
+ zend_hash_str_update(debug_info, "valid", sizeof("valid") - 1, &zv);
+ return debug_info;
}
+ ZVAL_TRUE(&zv);
+ zend_hash_str_update(debug_info, "valid", sizeof("valid") - 1, &zv);
- add_assoc_bool_ex(&zv, "valid", sizeof("valid"), 1);
-
- add_assoc_string_ex(&zv, "type", sizeof("type"),
- const_cast<char*>(cal->getType()));
-
+ ZVAL_STRING(&zv, const_cast<char*>(cal->getType()));
+ zend_hash_str_update(debug_info, "type", sizeof("type") - 1, &zv);
{
zval ztz,
ztz_debug;
int is_tmp;
- HashTable *debug_info;
+ HashTable *debug_info_tz;
timezone_object_construct(&cal->getTimeZone(), &ztz , 0 TSRMLS_CC);
debug_info = Z_OBJ_HANDLER(ztz, get_debug_info)(&ztz, &is_tmp TSRMLS_CC);
assert(is_tmp == 1);
- zend_hash_copy(Z_ARRVAL(ztz_debug), debug_info, NULL);
- add_assoc_zval_ex(&zv, "timeZone", sizeof("timeZone") - 1, &ztz_debug);
+ array_init(&ztz_debug);
+ zend_hash_copy(Z_ARRVAL(ztz_debug), debug_info_tz, zval_add_ref);
+ zend_hash_destroy(debug_info_tz);
+ FREE_HASHTABLE(debug_info_tz);
+
+ zend_hash_str_update(debug_info, "timeZone", sizeof("timeZone") - 1, &ztz_debug);
}
{
UErrorCode uec = U_ZERO_ERROR;
Locale locale = cal->getLocale(ULOC_VALID_LOCALE, uec);
if (U_SUCCESS(uec)) {
- add_assoc_string_ex(&zv, "locale", sizeof("locale") - 1,
- const_cast<char*>(locale.getName()));
+ ZVAL_STRING(&zv, const_cast<char*>(locale.getName()));
+ zend_hash_str_update(debug_info, "locale", sizeof("locale") - 1, &zv);
} else {
- add_assoc_string_ex(&zv, "locale", sizeof("locale") - 1,
- const_cast<char*>(u_errorName(uec)));
+ ZVAL_STRING(&zv, const_cast<char*>(u_errorName(uec)));
+ zend_hash_str_update(debug_info, "locale", sizeof("locale") - 1, &zv);
}
}
}
}
- add_assoc_zval_ex(&zv, "fields", sizeof("fields") - 1, &zfields);
+ zend_hash_str_update(debug_info, "fields", sizeof("fields") - 1, &zfields);
- return Z_ARRVAL(zv);
+ return debug_info;
}
/* }}} */
UnicodeString ustr;
char *str;
int str_len;
+ HashTable *debug_info;
UErrorCode uec = U_ZERO_ERROR;
*is_temp = 1;
- array_init_size(&zv, 4);
+ ALLOC_HASHTABLE(debug_info);
+ zend_hash_init(debug_info, 8, NULL, ZVAL_PTR_DTOR, 0);
to = Z_INTL_TIMEZONE_P(object);
tz = to->utimezone;
if (tz == NULL) {
- add_assoc_bool_ex(&zv, "valid", sizeof("valid"), 0);
- return Z_ARRVAL(zv);
+ ZVAL_FALSE(&zv);
+ zend_hash_str_update(debug_info, "valid", sizeof("valid") - 1, &zv);
+ return debug_info;
}
- add_assoc_bool_ex(&zv, "valid", sizeof("valid"), 1);
+ ZVAL_TRUE(&zv);
+ zend_hash_str_update(debug_info, "valid", sizeof("valid") - 1, &zv);
tz->getID(ustr);
intl_convert_utf16_to_utf8(&str, &str_len,
ustr.getBuffer(), ustr.length(), &uec);
if (U_FAILURE(uec)) {
- return Z_ARRVAL(zv);
+ return debug_info;
}
+ ZVAL_STRINGL(&zv, str, str_len);
+ zend_hash_str_update(debug_info, "id", sizeof("id") - 1, &zv);
// TODO: avoid reallocation ???
- add_assoc_stringl_ex(&zv, "id", sizeof("id"), str, str_len);
efree(str);
int32_t rawOffset, dstOffset;
UDate now = Calendar::getNow();
tz->getOffset(now, FALSE, rawOffset, dstOffset, uec);
if (U_FAILURE(uec)) {
- return Z_ARRVAL(zv);
+ return debug_info;
}
- add_assoc_long_ex(&zv, "rawOffset", sizeof("rawOffset"), (long)rawOffset);
- add_assoc_long_ex(&zv, "currentOffset", sizeof("currentOffset"),
- (long)(rawOffset + dstOffset));
+ ZVAL_LONG(&zv, (long)rawOffset);
+ zend_hash_str_update(debug_info,"rawOffset", sizeof("rawOffset") - 1, &zv);
+ ZVAL_LONG(&zv, (long)(rawOffset + dstOffset));
+ zend_hash_str_update(debug_info,"currentOffset", sizeof("currentOffset") - 1, &zv);
- return Z_ARRVAL(zv);
+ return debug_info;
}
/* }}} */