Skip to content

Commit 216d659

Browse files
committed
Convert some parameter parsing to the Fast Parameter Parsing API
1 parent fd0077b commit 216d659

File tree

4 files changed

+132
-90
lines changed

4 files changed

+132
-90
lines changed

ext/oci8/oci8.c

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,9 +1630,14 @@ void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclus
16301630
zend_long session_mode = OCI_DEFAULT;
16311631

16321632
/* if a fourth parameter is handed over, it is the charset identifier (but is only used in Oracle 9i+) */
1633-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|ssl", &username, &username_len, &password, &password_len, &dbname, &dbname_len, &charset, &charset_len, &session_mode) == FAILURE) {
1634-
return;
1635-
}
1633+
ZEND_PARSE_PARAMETERS_START(2, 5)
1634+
Z_PARAM_STRING(username, username_len)
1635+
Z_PARAM_STRING(password, password_len)
1636+
Z_PARAM_OPTIONAL
1637+
Z_PARAM_STRING(dbname, dbname_len)
1638+
Z_PARAM_STRING(charset, charset_len)
1639+
Z_PARAM_LONG(session_mode)
1640+
ZEND_PARSE_PARAMETERS_END();
16361641

16371642
#ifdef HAVE_OCI8_DTRACE
16381643
if (DTRACE_OCI8_CONNECT_ENTRY_ENABLED()) {
@@ -2547,9 +2552,12 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg
25472552
if (expected_args > 2) {
25482553
/* only for ocifetchinto BC */
25492554

2550-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz|l", &z_statement, &array, &fetch_mode) == FAILURE) {
2551-
return;
2552-
}
2555+
ZEND_PARSE_PARAMETERS_START(2, 3)
2556+
Z_PARAM_RESOURCE(z_statement)
2557+
Z_PARAM_ZVAL(array)
2558+
Z_PARAM_OPTIONAL
2559+
Z_PARAM_LONG(fetch_mode)
2560+
ZEND_PARSE_PARAMETERS_END();
25532561

25542562
if (ZEND_NUM_ARGS() == 2) {
25552563
fetch_mode = mode;
@@ -2563,19 +2571,21 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg
25632571
} else if (expected_args == 2) {
25642572
/* only for oci_fetch_array() */
25652573

2566-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &z_statement, &fetch_mode) == FAILURE) {
2567-
return;
2568-
}
2574+
ZEND_PARSE_PARAMETERS_START(1, 2)
2575+
Z_PARAM_RESOURCE(z_statement)
2576+
Z_PARAM_OPTIONAL
2577+
Z_PARAM_LONG(fetch_mode)
2578+
ZEND_PARSE_PARAMETERS_END();
25692579

25702580
if (ZEND_NUM_ARGS() == 1) {
25712581
fetch_mode = mode;
25722582
}
25732583
} else {
25742584
/* for all oci_fetch_*() */
25752585

2576-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_statement) == FAILURE) {
2577-
return;
2578-
}
2586+
ZEND_PARSE_PARAMETERS_START(1, 1)
2587+
Z_PARAM_RESOURCE(z_statement)
2588+
ZEND_PARSE_PARAMETERS_END();
25792589

25802590
fetch_mode = mode;
25812591
}

0 commit comments

Comments
 (0)