Skip to content

Commit 8d264f3

Browse files
committed
ext/standard: Convert more functions to fast ZPP
1 parent 1cc5591 commit 8d264f3

3 files changed

Lines changed: 34 additions & 17 deletions

File tree

‎ext/standard/dns_win32.c‎

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@ PHP_FUNCTION(dns_get_mx) /* {{{ */
3030
DNS_STATUS status; /* Return value of DnsQuery_A() function */
3131
PDNS_RECORD pResult, pRec; /* Pointer to DNS_RECORD structure */
3232

33-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "pz|z", &hostname, &hostname_len, &mx_list, &weight_list) == FAILURE) {
34-
RETURN_THROWS();
35-
}
33+
ZEND_PARSE_PARAMETERS_START(2, 3)
34+
Z_PARAM_PATH(hostname, hostname_len)
35+
Z_PARAM_ZVAL(mx_list)
36+
Z_PARAM_OPTIONAL
37+
Z_PARAM_ZVAL(weight_list)
38+
ZEND_PARSE_PARAMETERS_END();
3639

3740
status = DnsQuery_A(hostname, DNS_TYPE_MX, DNS_QUERY_STANDARD, NULL, &pResult, NULL);
3841

@@ -84,9 +87,11 @@ PHP_FUNCTION(dns_check_record)
8487
DNS_STATUS status; /* Return value of DnsQuery_A() function */
8588
PDNS_RECORD pResult; /* Pointer to DNS_RECORD structure */
8689

87-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|S", &hostname, &hostname_len, &rectype) == FAILURE) {
88-
RETURN_THROWS();
89-
}
90+
ZEND_PARSE_PARAMETERS_START(1, 2)
91+
Z_PARAM_PATH(hostname, hostname_len)
92+
Z_PARAM_OPTIONAL
93+
Z_PARAM_STR(rectype)
94+
ZEND_PARSE_PARAMETERS_END();
9095

9196
if (hostname_len == 0) {
9297
zend_argument_must_not_be_empty_error(1);
@@ -337,10 +342,14 @@ PHP_FUNCTION(dns_get_record)
337342
int type, type_to_fetch, first_query = 1, store_results = 1;
338343
bool raw = false;
339344

340-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|lz!z!b",
341-
&hostname, &hostname_len, &type_param, &authns, &addtl, &raw) == FAILURE) {
342-
RETURN_THROWS();
343-
}
345+
ZEND_PARSE_PARAMETERS_START(1, 5)
346+
Z_PARAM_PATH(hostname, hostname_len)
347+
Z_PARAM_OPTIONAL
348+
Z_PARAM_LONG(type_param)
349+
Z_PARAM_ZVAL_OR_NULL(authns)
350+
Z_PARAM_ZVAL_OR_NULL(addtl)
351+
Z_PARAM_BOOL(raw)
352+
ZEND_PARSE_PARAMETERS_END();
344353

345354
if (authns) {
346355
authns = zend_try_array_init(authns);

‎ext/standard/levenshtein.c‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,14 @@ PHP_FUNCTION(levenshtein)
8080
zend_long cost_rep = 1;
8181
zend_long cost_del = 1;
8282

83-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|lll", &string1, &string2, &cost_ins, &cost_rep, &cost_del) == FAILURE) {
84-
RETURN_THROWS();
85-
}
86-
83+
ZEND_PARSE_PARAMETERS_START(2, 5)
84+
Z_PARAM_STR(string1)
85+
Z_PARAM_STR(string2)
86+
Z_PARAM_OPTIONAL
87+
Z_PARAM_LONG(cost_ins)
88+
Z_PARAM_LONG(cost_rep)
89+
Z_PARAM_LONG(cost_del)
90+
ZEND_PARSE_PARAMETERS_END();
8791

8892
RETURN_LONG(reference_levdist(string1, string2, cost_ins, cost_rep, cost_del));
8993
}

‎ext/standard/user_filters.c‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ PHP_METHOD(php_user_filter, filter)
3333
{
3434
zval *in, *out, *consumed;
3535
bool closing;
36-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrzb", &in, &out, &consumed, &closing) == FAILURE) {
37-
RETURN_THROWS();
38-
}
36+
37+
ZEND_PARSE_PARAMETERS_START(4, 4)
38+
Z_PARAM_RESOURCE(in)
39+
Z_PARAM_RESOURCE(out)
40+
Z_PARAM_ZVAL(consumed)
41+
Z_PARAM_BOOL(closing)
42+
ZEND_PARSE_PARAMETERS_END();
3943

4044
RETURN_LONG(PSFS_ERR_FATAL);
4145
}

0 commit comments

Comments
 (0)