summaryrefslogtreecommitdiff
path: root/ext/intl
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2015-06-30 04:05:24 +0300
committerDmitry Stogov <dmitry@zend.com>2015-06-30 04:05:24 +0300
commit4a2e40bb861bc3cf5fb6863e57486ed60316e97c (patch)
tree6579660b282fdd1bc50095e48d702913a0b6aa97 /ext/intl
parent8cce5b2641fb91c3073018b59f6f044b843041a8 (diff)
downloadphp-git-4a2e40bb861bc3cf5fb6863e57486ed60316e97c.tar.gz
Use ZSTR_ API to access zend_string elements (this is just renaming without semantick changes).
Diffstat (limited to 'ext/intl')
-rw-r--r--ext/intl/breakiterator/breakiterator_class.cpp2
-rw-r--r--ext/intl/breakiterator/breakiterator_iterators.cpp12
-rw-r--r--ext/intl/breakiterator/breakiterator_methods.cpp2
-rw-r--r--ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp6
-rw-r--r--ext/intl/calendar/calendar_class.cpp2
-rw-r--r--ext/intl/converter/converter.c2
-rw-r--r--ext/intl/idn/idn.c8
-rw-r--r--ext/intl/locale/locale_methods.c2
-rw-r--r--ext/intl/msgformat/msgformat_helpers.cpp4
-rw-r--r--ext/intl/timezone/timezone_class.cpp2
-rw-r--r--ext/intl/transliterator/transliterator_class.c2
-rw-r--r--ext/intl/transliterator/transliterator_methods.c4
-rw-r--r--ext/intl/uchar/uchar.c2
13 files changed, 25 insertions, 25 deletions
diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp
index 813204cd21..db99ad09cf 100644
--- a/ext/intl/breakiterator/breakiterator_class.cpp
+++ b/ext/intl/breakiterator/breakiterator_class.cpp
@@ -120,7 +120,7 @@ static zend_object *BreakIterator_clone_obj(zval *object)
intl_errors_set_custom_msg(BREAKITER_ERROR_P(bio_orig),
"Could not clone BreakIterator", 0);
err_msg = intl_error_get_message(BREAKITER_ERROR_P(bio_orig));
- zend_throw_exception(NULL, err_msg->val, 0);
+ zend_throw_exception(NULL, ZSTR_VAL(err_msg), 0);
zend_string_free(err_msg);
} else {
bio_new->biter = new_biter;
diff --git a/ext/intl/breakiterator/breakiterator_iterators.cpp b/ext/intl/breakiterator/breakiterator_iterators.cpp
index aa2f92763b..bdf1b3e53f 100644
--- a/ext/intl/breakiterator/breakiterator_iterators.cpp
+++ b/ext/intl/breakiterator/breakiterator_iterators.cpp
@@ -177,8 +177,8 @@ static void _breakiterator_parts_move_forward(zend_object_iterator *iter)
assert(next <= slen && next >= cur);
res = zend_string_alloc(next - cur, 0);
- memcpy(res->val, &s[cur], res->len);
- res->val[res->len] = '\0';
+ memcpy(ZSTR_VAL(res), &s[cur], ZSTR_LEN(res));
+ ZSTR_VAL(res)[ZSTR_LEN(res)] = '\0';
ZVAL_STR(&zoi_bit->zoi_cur.current, res);
}
@@ -249,14 +249,14 @@ U_CFUNC zend_function *IntlPartsIterator_get_method(zend_object **object_ptr, ze
ALLOCA_FLAG(use_heap);
if (key == NULL) {
- ZSTR_ALLOCA_ALLOC(lc_method_name, method->len, use_heap);
- zend_str_tolower_copy(lc_method_name->val, method->val, method->len);
+ ZSTR_ALLOCA_ALLOC(lc_method_name, ZSTR_LEN(method), use_heap);
+ zend_str_tolower_copy(ZSTR_VAL(lc_method_name), ZSTR_VAL(method), ZSTR_LEN(method));
} else {
lc_method_name = Z_STR_P(key);
}
- if (method->len == sizeof("getrulestatus") - 1
- && memcmp("getrulestatus", lc_method_name->val, lc_method_name->len) == 0) {
+ if (ZSTR_LEN(method) == sizeof("getrulestatus") - 1
+ && memcmp("getrulestatus", ZSTR_VAL(lc_method_name), ZSTR_LEN(lc_method_name)) == 0) {
IntlIterator_object *obj = php_intl_iterator_fetch_object(*object_ptr);
if (obj->iterator && !Z_ISUNDEF(obj->iterator->data)) {
zval *break_iter_zv = &obj->iterator->data;
diff --git a/ext/intl/breakiterator/breakiterator_methods.cpp b/ext/intl/breakiterator/breakiterator_methods.cpp
index ce855ebacd..0363198f06 100644
--- a/ext/intl/breakiterator/breakiterator_methods.cpp
+++ b/ext/intl/breakiterator/breakiterator_methods.cpp
@@ -161,7 +161,7 @@ U_CFUNC PHP_FUNCTION(breakiter_set_text)
BREAKITER_METHOD_FETCH_OBJECT;
- ut = utext_openUTF8(ut, text->val, text->len, BREAKITER_ERROR_CODE_P(bio));
+ ut = utext_openUTF8(ut, ZSTR_VAL(text), ZSTR_LEN(text), BREAKITER_ERROR_CODE_P(bio));
INTL_METHOD_CHECK_STATUS_OR_NULL(bio, "breakiter_set_text: error opening UText");
bio->biter->setText(ut, BREAKITER_ERROR_CODE(bio));
diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
index 8acf128b2c..1988e7477d 100644
--- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
+++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
@@ -66,7 +66,7 @@ static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
smart_str parse_error_str;
parse_error_str = intl_parse_error_to_string(&parseError);
spprintf(&msg, 0, "rbbi_create_instance: unable to create "
- "RuleBasedBreakIterator from rules (%s)", parse_error_str.s? parse_error_str.s->val : "");
+ "RuleBasedBreakIterator from rules (%s)", parse_error_str.s? ZSTR_VAL(parse_error_str.s) : "");
smart_str_free(&parse_error_str);
intl_error_set_custom_msg(NULL, msg, 1);
efree(msg);
@@ -211,8 +211,8 @@ U_CFUNC PHP_FUNCTION(rbbi_get_binary_rules)
}
zend_string *ret_rules = zend_string_alloc(rules_len, 0);
- memcpy(ret_rules->val, rules, rules_len);
- ret_rules->val[rules_len] = '\0';
+ memcpy(ZSTR_VAL(ret_rules), rules, rules_len);
+ ZSTR_VAL(ret_rules)[rules_len] = '\0';
RETURN_STR(ret_rules);
}
diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp
index 8af48d9726..6b6feef8d9 100644
--- a/ext/intl/calendar/calendar_class.cpp
+++ b/ext/intl/calendar/calendar_class.cpp
@@ -101,7 +101,7 @@ static zend_object *Calendar_clone_obj(zval *object)
intl_errors_set_custom_msg(CALENDAR_ERROR_P(co_orig),
"Could not clone IntlCalendar", 0);
err_msg = intl_error_get_message(CALENDAR_ERROR_P(co_orig));
- zend_throw_exception(NULL, err_msg->val, 0);
+ zend_throw_exception(NULL, ZSTR_VAL(err_msg), 0);
zend_string_free(err_msg);
} else {
co_new->ucal = newCalendar;
diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c
index 621d0ead12..fe8c32be6f 100644
--- a/ext/intl/converter/converter.c
+++ b/ext/intl/converter/converter.c
@@ -1068,7 +1068,7 @@ static zend_object *php_converter_clone_object(zval *object) {
THROW_UFAILURE(oldobj, "ucnv_safeClone", error);
err_msg = intl_error_get_message(&oldobj->error);
- zend_throw_exception(NULL, err_msg->val, 0);
+ zend_throw_exception(NULL, ZSTR_VAL(err_msg), 0);
zend_string_release(err_msg);
return retval;
diff --git a/ext/intl/idn/idn.c b/ext/intl/idn/idn.c
index c0773e8c0c..5dd742b87e 100644
--- a/ext/intl/idn/idn.c
+++ b/ext/intl/idn/idn.c
@@ -153,10 +153,10 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS,
if (mode == INTL_IDN_TO_ASCII) {
len = uidna_nameToASCII_UTF8(uts46, domain, domain_len,
- buffer->val, buffer_capac, &info, &status);
+ ZSTR_VAL(buffer), buffer_capac, &info, &status);
} else {
len = uidna_nameToUnicodeUTF8(uts46, domain, domain_len,
- buffer->val, buffer_capac, &info, &status);
+ ZSTR_VAL(buffer), buffer_capac, &info, &status);
}
if (php_intl_idn_check_status(status, "failed to convert name",
mode) == FAILURE) {
@@ -168,8 +168,8 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS,
php_error_docref(NULL, E_ERROR, "ICU returned an unexpected length");
}
- buffer->val[len] = '\0';
- buffer->len = len;
+ ZSTR_VAL(buffer)[len] = '\0';
+ ZSTR_LEN(buffer) = len;
if (info.errors == 0) {
RETVAL_STR(buffer);
diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c
index 536792e853..7b36d61c02 100644
--- a/ext/intl/locale/locale_methods.c
+++ b/ext/intl/locale/locale_methods.c
@@ -235,7 +235,7 @@ PHP_NAMED_FUNCTION(zif_locale_set_default)
RETURN_FALSE;
}
- if (locale_name->len == 0) {
+ if (ZSTR_LEN(locale_name) == 0) {
default_locale = (char *)uloc_getDefault();
locale_name = zend_string_init(default_locale, strlen(default_locale), 0);
}
diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp
index d6839cbed0..a2bede910a 100644
--- a/ext/intl/msgformat/msgformat_helpers.cpp
+++ b/ext/intl/msgformat/msgformat_helpers.cpp
@@ -413,12 +413,12 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
storedArgType = (Formattable::Type*)zend_hash_index_find_ptr(types, (zend_ulong)num_index);
} else { //string; assumed to be in UTF-8
- intl_stringFromChar(key, str_index->val, str_index->len, &err.code);
+ intl_stringFromChar(key, ZSTR_VAL(str_index), ZSTR_LEN(str_index), &err.code);
if (U_FAILURE(err.code)) {
char *message;
spprintf(&message, 0,
- "Invalid UTF-8 data in argument key: '%s'", str_index->val);
+ "Invalid UTF-8 data in argument key: '%s'", ZSTR_VAL(str_index));
intl_errors_set(&err, err.code, message, 1);
efree(message);
continue;
diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp
index 8b4d6ef127..77569c09e2 100644
--- a/ext/intl/timezone/timezone_class.cpp
+++ b/ext/intl/timezone/timezone_class.cpp
@@ -248,7 +248,7 @@ static zend_object *TimeZone_clone_obj(zval *object)
intl_errors_set_custom_msg(TIMEZONE_ERROR_P(to_orig),
"Could not clone IntlTimeZone", 0);
err_msg = intl_error_get_message(TIMEZONE_ERROR_P(to_orig));
- zend_throw_exception(NULL, err_msg->val, 0);
+ zend_throw_exception(NULL, ZSTR_VAL(err_msg), 0);
zend_string_free(err_msg);
} else {
to_new->utimezone = newTimeZone;
diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c
index 4395cc086a..f2cb9f42e4 100644
--- a/ext/intl/transliterator/transliterator_class.c
+++ b/ext/intl/transliterator/transliterator_class.c
@@ -182,7 +182,7 @@ err:
"Could not clone transliterator", 0 );
err_msg = intl_error_get_message( TRANSLITERATOR_ERROR_P( to_orig ) );
- php_error_docref( NULL, E_ERROR, "%s", err_msg->val );
+ php_error_docref( NULL, E_ERROR, "%s", ZSTR_VAL(err_msg) );
zend_string_free( err_msg ); /* if it's changed into a warning */
/* do not destroy tempz; we need to return something */
}
diff --git a/ext/intl/transliterator/transliterator_methods.c b/ext/intl/transliterator/transliterator_methods.c
index ced84a0c60..4fcdf3dea2 100644
--- a/ext/intl/transliterator/transliterator_methods.c
+++ b/ext/intl/transliterator/transliterator_methods.c
@@ -185,7 +185,7 @@ PHP_FUNCTION( transliterator_create_from_rules )
smart_str parse_error_str;
parse_error_str = intl_parse_error_to_string( &parse_error );
spprintf( &msg, 0, "transliterator_create_from_rules: unable to "
- "create ICU transliterator from rules (%s)", parse_error_str.s? parse_error_str.s->val : "" );
+ "create ICU transliterator from rules (%s)", parse_error_str.s? ZSTR_VAL(parse_error_str.s) : "" );
smart_str_free( &parse_error_str );
if( msg != NULL )
{
@@ -348,7 +348,7 @@ PHP_FUNCTION( transliterator_transliterate )
{
zend_string *message = intl_error_get_message( NULL );
php_error_docref0( NULL, E_WARNING, "Could not create "
- "transliterator with ID \"%s\" (%s)", Z_STRVAL_P( arg1 ), message->val );
+ "transliterator with ID \"%s\" (%s)", Z_STRVAL_P( arg1 ), ZSTR_VAL(message) );
zend_string_free( message );
ZVAL_UNDEF(&tmp_object);
/* don't set U_ILLEGAL_ARGUMENT_ERROR to allow fetching of inner error */
diff --git a/ext/intl/uchar/uchar.c b/ext/intl/uchar/uchar.c
index 98d92e44d7..a38723ea9c 100644
--- a/ext/intl/uchar/uchar.c
+++ b/ext/intl/uchar/uchar.c
@@ -247,7 +247,7 @@ IC_METHOD(charName) {
buffer_len = u_charName(cp, (UCharNameChoice)nameChoice, NULL, 0, &error);
buffer = zend_string_alloc(buffer_len, 0);
error = U_ZERO_ERROR;
- buffer_len = u_charName(cp, (UCharNameChoice)nameChoice, buffer->val, buffer->len + 1, &error);
+ buffer_len = u_charName(cp, (UCharNameChoice)nameChoice, ZSTR_VAL(buffer), ZSTR_LEN(buffer) + 1, &error);
if (U_FAILURE(error)) {
zend_string_free(buffer);
INTL_CHECK_STATUS(error, "Failure getting character name");