mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
ext/intl last chunk of fast ZPP conversion (#14431)
This commit is contained in:
@@ -246,9 +246,7 @@ U_CFUNC PHP_METHOD(IntlPartsIterator, getBreakIterator)
|
||||
{
|
||||
INTLITERATOR_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
INTLITERATOR_METHOD_FETCH_OBJECT;
|
||||
|
||||
@@ -259,9 +257,7 @@ U_CFUNC PHP_METHOD(IntlPartsIterator, getRuleStatus)
|
||||
{
|
||||
INTLITERATOR_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
INTLITERATOR_METHOD_FETCH_OBJECT;
|
||||
|
||||
|
||||
@@ -46,19 +46,19 @@ static void _breakiter_factory(const char *func_name,
|
||||
INTERNAL_FUNCTION_PARAMETERS)
|
||||
{
|
||||
BreakIterator *biter;
|
||||
const char *locale_str = NULL;
|
||||
char *locale_str = NULL;
|
||||
size_t dummy;
|
||||
char *msg;
|
||||
UErrorCode status = UErrorCode();
|
||||
intl_error_reset(NULL);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!",
|
||||
&locale_str, &dummy) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_START(0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_STRING_OR_NULL(locale_str, dummy)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if (locale_str == NULL) {
|
||||
locale_str = intl_locale_get_default();
|
||||
locale_str = (char *)intl_locale_get_default();
|
||||
}
|
||||
|
||||
biter = func(Locale::createFromName(locale_str), status);
|
||||
@@ -113,9 +113,7 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, createCodePointInstance)
|
||||
{
|
||||
intl_error_reset(NULL);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
CodePointBreakIterator *cpbi = new CodePointBreakIterator();
|
||||
breakiterator_object_create(return_value, cpbi, 1);
|
||||
@@ -126,9 +124,7 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, getText)
|
||||
BREAKITER_METHOD_INIT_VARS;
|
||||
object = ZEND_THIS;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
BREAKITER_METHOD_FETCH_OBJECT;
|
||||
|
||||
@@ -146,9 +142,9 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, setText)
|
||||
BREAKITER_METHOD_INIT_VARS;
|
||||
object = ZEND_THIS;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &text) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(text)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
BREAKITER_METHOD_FETCH_OBJECT;
|
||||
|
||||
@@ -176,9 +172,7 @@ static void _breakiter_no_args_ret_int32(
|
||||
BREAKITER_METHOD_INIT_VARS;
|
||||
object = ZEND_THIS;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
BREAKITER_METHOD_FETCH_OBJECT;
|
||||
|
||||
@@ -195,9 +189,9 @@ static void _breakiter_int32_ret_int32(
|
||||
BREAKITER_METHOD_INIT_VARS;
|
||||
object = ZEND_THIS;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &arg) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(arg)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
BREAKITER_METHOD_FETCH_OBJECT;
|
||||
|
||||
@@ -233,16 +227,13 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, next)
|
||||
{
|
||||
zval *arg = NULL;
|
||||
|
||||
if (ZEND_NUM_ARGS() == 0) {
|
||||
goto no_arg_version;
|
||||
}
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z!", &arg) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_START(0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_ZVAL_OR_NULL(arg)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if (arg == NULL) {
|
||||
ZEND_NUM_ARGS() = 0; /* pretend we don't have any argument */
|
||||
no_arg_version:
|
||||
ZEND_NUM_ARGS() = 0;
|
||||
_breakiter_no_args_ret_int32(&BreakIterator::next,
|
||||
INTERNAL_FUNCTION_PARAM_PASSTHRU);
|
||||
} else {
|
||||
@@ -256,9 +247,7 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, current)
|
||||
BREAKITER_METHOD_INIT_VARS;
|
||||
object = ZEND_THIS;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
BREAKITER_METHOD_FETCH_OBJECT;
|
||||
|
||||
@@ -287,10 +276,9 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, isBoundary)
|
||||
BREAKITER_METHOD_INIT_VARS;
|
||||
object = ZEND_THIS;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l",
|
||||
&offset) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(offset)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if (UNEXPECTED(offset < INT32_MIN || offset > INT32_MAX)) {
|
||||
zend_argument_value_error(1, "must be between %d and %d", INT32_MIN, INT32_MAX);
|
||||
@@ -310,9 +298,9 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, getLocale)
|
||||
BREAKITER_METHOD_INIT_VARS;
|
||||
object = ZEND_THIS;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &locale_type) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(locale_type)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
/* Change to ValueError? */
|
||||
if (locale_type != ULOC_ACTUAL_LOCALE && locale_type != ULOC_VALID_LOCALE) {
|
||||
@@ -337,9 +325,10 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, getPartsIterator)
|
||||
BREAKITER_METHOD_INIT_VARS;
|
||||
object = ZEND_THIS;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &key_type) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_START(0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(key_type)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if (key_type != PARTS_ITERATOR_KEY_SEQUENTIAL
|
||||
&& key_type != PARTS_ITERATOR_KEY_LEFT
|
||||
@@ -360,9 +349,7 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, getErrorCode)
|
||||
BREAKITER_METHOD_INIT_VARS;
|
||||
object = ZEND_THIS;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
/* Fetch the object (without resetting its last error code ). */
|
||||
bio = Z_INTL_BREAKITERATOR_P(object);
|
||||
@@ -375,10 +362,7 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, getErrorMessage)
|
||||
BREAKITER_METHOD_INIT_VARS;
|
||||
object = ZEND_THIS;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
/* Fetch the object (without resetting its last error code ). */
|
||||
bio = Z_INTL_BREAKITERATOR_P(object);
|
||||
@@ -390,9 +374,7 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, getErrorMessage)
|
||||
|
||||
U_CFUNC PHP_METHOD(IntlBreakIterator, getIterator)
|
||||
{
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
zend_create_internal_iterator_zval(return_value, ZEND_THIS);
|
||||
}
|
||||
|
||||
@@ -30,9 +30,7 @@ U_CFUNC PHP_METHOD(IntlCodePointBreakIterator, getLastCodePoint)
|
||||
BREAKITER_METHOD_INIT_VARS;
|
||||
object = ZEND_THIS;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
BREAKITER_METHOD_FETCH_OBJECT;
|
||||
|
||||
|
||||
@@ -36,15 +36,16 @@ static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS, zend_er
|
||||
{
|
||||
char *rules;
|
||||
size_t rules_len;
|
||||
bool compiled = 0;
|
||||
bool compiled = false;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
BREAKITER_METHOD_INIT_VARS;
|
||||
object = ZEND_THIS;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b",
|
||||
&rules, &rules_len, &compiled) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_START(1, 2)
|
||||
Z_PARAM_STRING(rules, rules_len)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_BOOL(compiled)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
BREAKITER_METHOD_FETCH_OBJECT_NO_CHECK;
|
||||
if (bio->biter) {
|
||||
@@ -113,9 +114,7 @@ U_CFUNC PHP_METHOD(IntlRuleBasedBreakIterator, getRules)
|
||||
BREAKITER_METHOD_INIT_VARS;
|
||||
object = ZEND_THIS;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
BREAKITER_METHOD_FETCH_OBJECT;
|
||||
|
||||
@@ -138,9 +137,7 @@ U_CFUNC PHP_METHOD(IntlRuleBasedBreakIterator, getRuleStatus)
|
||||
BREAKITER_METHOD_INIT_VARS;
|
||||
object = ZEND_THIS;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
BREAKITER_METHOD_FETCH_OBJECT;
|
||||
|
||||
@@ -152,9 +149,7 @@ U_CFUNC PHP_METHOD(IntlRuleBasedBreakIterator, getRuleStatusVec)
|
||||
BREAKITER_METHOD_INIT_VARS;
|
||||
object = ZEND_THIS;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
BREAKITER_METHOD_FETCH_OBJECT;
|
||||
|
||||
@@ -185,9 +180,7 @@ U_CFUNC PHP_METHOD(IntlRuleBasedBreakIterator, getBinaryRules)
|
||||
BREAKITER_METHOD_INIT_VARS;
|
||||
object = ZEND_THIS;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
BREAKITER_METHOD_FETCH_OBJECT;
|
||||
|
||||
|
||||
@@ -316,9 +316,11 @@ PHP_FUNCTION( normalizer_get_raw_decomposition )
|
||||
|
||||
intl_error_reset(NULL);
|
||||
|
||||
if ((zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &input, &input_length, &form) == FAILURE)) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_START(1, 2)
|
||||
Z_PARAM_STRING(input, input_length)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(form)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
norm = intl_get_normalizer(form, &status);
|
||||
|
||||
|
||||
@@ -74,22 +74,23 @@ static zend_object *ResourceBundle_object_create( zend_class_entry *ce )
|
||||
/* {{{ ResourceBundle_ctor */
|
||||
static int resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_error_handling *error_handling, bool *error_handling_replaced)
|
||||
{
|
||||
const char *bundlename;
|
||||
char *bundlename;
|
||||
size_t bundlename_len = 0;
|
||||
const char *locale;
|
||||
char *locale;
|
||||
size_t locale_len = 0;
|
||||
bool fallback = 1;
|
||||
bool fallback = true;
|
||||
|
||||
zval *object = return_value;
|
||||
ResourceBundle_object *rb = Z_INTL_RESOURCEBUNDLE_P( object );
|
||||
|
||||
intl_error_reset( NULL );
|
||||
|
||||
if( zend_parse_parameters( ZEND_NUM_ARGS(), "s!s!|b",
|
||||
&locale, &locale_len, &bundlename, &bundlename_len, &fallback ) == FAILURE )
|
||||
{
|
||||
return FAILURE;
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_START(2, 3)
|
||||
Z_PARAM_STRING_OR_NULL(locale, locale_len)
|
||||
Z_PARAM_STRING_OR_NULL(bundlename, bundlename_len)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_BOOL(fallback)
|
||||
ZEND_PARSE_PARAMETERS_END_EX(return FAILURE);
|
||||
|
||||
if (error_handling != NULL) {
|
||||
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, error_handling);
|
||||
@@ -104,7 +105,7 @@ static int resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_error_handling
|
||||
INTL_CHECK_LOCALE_LEN_OR_FAILURE(locale_len);
|
||||
|
||||
if (locale == NULL) {
|
||||
locale = intl_locale_get_default();
|
||||
locale = (char *)intl_locale_get_default();
|
||||
}
|
||||
|
||||
if (bundlename_len >= MAXPATHLEN) {
|
||||
@@ -344,10 +345,9 @@ PHP_FUNCTION( resourcebundle_locales )
|
||||
|
||||
intl_errors_reset( NULL );
|
||||
|
||||
if( zend_parse_parameters(ZEND_NUM_ARGS(), "s", &bundlename, &bundlename_len ) == FAILURE )
|
||||
{
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STRING(bundlename, bundlename_len)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if (bundlename_len >= MAXPATHLEN) {
|
||||
zend_argument_value_error(1, "is too long");
|
||||
@@ -409,9 +409,7 @@ PHP_FUNCTION( resourcebundle_get_error_message )
|
||||
/* }}} */
|
||||
|
||||
PHP_METHOD(ResourceBundle, getIterator) {
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
zend_create_internal_iterator_zval(return_value, ZEND_THIS);
|
||||
}
|
||||
|
||||
@@ -105,11 +105,11 @@ PHP_FUNCTION( transliterator_create )
|
||||
|
||||
(void) to; /* unused */
|
||||
|
||||
if( zend_parse_parameters( ZEND_NUM_ARGS(), "s|l",
|
||||
&str_id, &str_id_len, &direction ) == FAILURE )
|
||||
{
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_START(1, 2)
|
||||
Z_PARAM_STRING(str_id, str_id_len)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(direction)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
object = return_value;
|
||||
res = create_transliterator( str_id, str_id_len, direction, object );
|
||||
@@ -134,11 +134,11 @@ PHP_FUNCTION( transliterator_create_from_rules )
|
||||
0x61, 0x6E, 0x73, 0x50, 0x48, 0x50, 0}; /* RulesTransPHP */
|
||||
TRANSLITERATOR_METHOD_INIT_VARS;
|
||||
|
||||
if( zend_parse_parameters( ZEND_NUM_ARGS(), "s|l",
|
||||
&str_rules, &str_rules_len, &direction ) == FAILURE )
|
||||
{
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_START(1, 2)
|
||||
Z_PARAM_STRING(str_rules, str_rules_len)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(direction)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if( ( direction != TRANSLITERATOR_FORWARD ) && (direction != TRANSLITERATOR_REVERSE ) )
|
||||
{
|
||||
@@ -225,10 +225,7 @@ PHP_FUNCTION( transliterator_list_ids )
|
||||
|
||||
intl_error_reset( NULL );
|
||||
|
||||
if( zend_parse_parameters_none() == FAILURE )
|
||||
{
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
en = utrans_openIDs( &status );
|
||||
INTL_CHECK_STATUS( status,
|
||||
|
||||
Reference in New Issue
Block a user