Skip to content

Commit c39bcaa

Browse files
authored
ext/int: UChar using fast ZPP (#14420)
1 parent 8112889 commit c39bcaa

File tree

1 file changed

+38
-30
lines changed

1 file changed

+38
-30
lines changed

ext/intl/uchar/uchar.c

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ IC_METHOD(getIntPropertyValue) {
125125
IC_METHOD(getIntPropertyMinValue) {
126126
zend_long prop;
127127

128-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &prop) == FAILURE) {
129-
RETURN_THROWS();
130-
}
128+
ZEND_PARSE_PARAMETERS_START(1, 1)
129+
Z_PARAM_LONG(prop)
130+
ZEND_PARSE_PARAMETERS_END();
131131

132132
RETURN_LONG(u_getIntPropertyMinValue((UProperty)prop));
133133
}
@@ -137,9 +137,9 @@ IC_METHOD(getIntPropertyMinValue) {
137137
IC_METHOD(getIntPropertyMaxValue) {
138138
zend_long prop;
139139

140-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &prop) == FAILURE) {
141-
RETURN_THROWS();
142-
}
140+
ZEND_PARSE_PARAMETERS_START(1, 1)
141+
Z_PARAM_LONG(prop)
142+
ZEND_PARSE_PARAMETERS_END();
143143

144144
RETURN_LONG(u_getIntPropertyMaxValue((UProperty)prop));
145145
}
@@ -191,9 +191,9 @@ static UBool enumCharType_callback(enumCharType_data *context,
191191
IC_METHOD(enumCharTypes) {
192192
enumCharType_data context;
193193

194-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "f", &context.fci, &context.fci_cache) == FAILURE) {
195-
RETURN_THROWS();
196-
}
194+
ZEND_PARSE_PARAMETERS_START(1, 1)
195+
Z_PARAM_FUNC(context.fci, context.fci_cache)
196+
ZEND_PARSE_PARAMETERS_END();
197197
u_enumCharTypes((UCharEnumTypeRange*)enumCharType_callback, &context);
198198
}
199199
/* }}} */
@@ -250,9 +250,11 @@ IC_METHOD(charFromName) {
250250
UChar32 ret;
251251
UErrorCode error = U_ZERO_ERROR;
252252

253-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &name, &name_len, &nameChoice) == FAILURE) {
254-
RETURN_THROWS();
255-
}
253+
ZEND_PARSE_PARAMETERS_START(1, 2)
254+
Z_PARAM_STRING(name, name_len)
255+
Z_PARAM_OPTIONAL
256+
Z_PARAM_LONG(nameChoice)
257+
ZEND_PARSE_PARAMETERS_END();
256258

257259
ret = u_charFromName((UCharNameChoice)nameChoice, name, &error);
258260
INTL_CHECK_STATUS_OR_NULL(error, NULL);
@@ -324,9 +326,11 @@ IC_METHOD(getPropertyName) {
324326
zend_long nameChoice = U_LONG_PROPERTY_NAME;
325327
const char *ret;
326328

327-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &property, &nameChoice) == FAILURE) {
328-
RETURN_THROWS();
329-
}
329+
ZEND_PARSE_PARAMETERS_START(1, 2)
330+
Z_PARAM_LONG(property)
331+
Z_PARAM_OPTIONAL
332+
Z_PARAM_LONG(nameChoice)
333+
ZEND_PARSE_PARAMETERS_END();
330334

331335
ret = u_getPropertyName((UProperty)property, (UPropertyNameChoice)nameChoice);
332336
if (ret) {
@@ -344,9 +348,9 @@ IC_METHOD(getPropertyEnum) {
344348
char *alias;
345349
size_t alias_len;
346350

347-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &alias, &alias_len) == FAILURE) {
348-
RETURN_THROWS();
349-
}
351+
ZEND_PARSE_PARAMETERS_START(1, 1)
352+
Z_PARAM_STRING(alias, alias_len)
353+
ZEND_PARSE_PARAMETERS_END();
350354

351355
RETURN_LONG(u_getPropertyEnum(alias));
352356
}
@@ -357,9 +361,12 @@ IC_METHOD(getPropertyValueName) {
357361
zend_long property, value, nameChoice = U_LONG_PROPERTY_NAME;
358362
const char *ret;
359363

360-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|l", &property, &value, &nameChoice) == FAILURE) {
361-
RETURN_THROWS();
362-
}
364+
ZEND_PARSE_PARAMETERS_START(2, 3)
365+
Z_PARAM_LONG(property)
366+
Z_PARAM_LONG(value)
367+
Z_PARAM_OPTIONAL
368+
Z_PARAM_LONG(nameChoice)
369+
ZEND_PARSE_PARAMETERS_END();
363370

364371
ret = u_getPropertyValueName((UProperty)property, value, (UPropertyNameChoice)nameChoice);
365372
if (ret) {
@@ -378,9 +385,10 @@ IC_METHOD(getPropertyValueEnum) {
378385
char *name;
379386
size_t name_len;
380387

381-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &property, &name, &name_len) == FAILURE) {
382-
RETURN_THROWS();
383-
}
388+
ZEND_PARSE_PARAMETERS_START(2, 2)
389+
Z_PARAM_LONG(property)
390+
Z_PARAM_STRING(name, name_len)
391+
ZEND_PARSE_PARAMETERS_END();
384392

385393
RETURN_LONG(u_getPropertyValueEnum((UProperty)property, name));
386394
}
@@ -447,9 +455,11 @@ IC_METHOD(digit) {
447455
IC_METHOD(forDigit) {
448456
zend_long digit, radix = 10;
449457

450-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &digit, &radix) == FAILURE) {
451-
RETURN_THROWS();
452-
}
458+
ZEND_PARSE_PARAMETERS_START(1, 2)
459+
Z_PARAM_LONG(digit)
460+
Z_PARAM_OPTIONAL
461+
Z_PARAM_LONG(radix)
462+
ZEND_PARSE_PARAMETERS_END();
453463

454464
RETURN_LONG(u_forDigit(digit, radix));
455465
}
@@ -478,9 +488,7 @@ IC_METHOD(getUnicodeVersion) {
478488
UVersionInfo version;
479489
int i;
480490

481-
if (zend_parse_parameters_none() == FAILURE) {
482-
RETURN_THROWS();
483-
}
491+
ZEND_PARSE_PARAMETERS_NONE();
484492

485493
u_getUnicodeVersion(version);
486494
array_init(return_value);

0 commit comments

Comments
 (0)