Skip to content

Commit 75da34e

Browse files
author
Andrei Zmievski
committed
Fix it up a bit.
1 parent ecc2fae commit 75da34e

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

ext/skeleton/create_stubs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,18 @@ BEGIN {
114114
argnames[num_funcs,args_max] = arg_name
115115

116116
args_max++
117-
spec_str = spec_str spec_map[arg_type]
118117
if (optional) {
119-
optionals[num_funcs,i] = optional
120-
if (arg_type != "resource") {
121-
useswitch[num_funcs] = 1
118+
if (!spec_opt) {
119+
spec_str = spec_str "|"
120+
spec_opt = 1
122121
}
122+
optionals[num_funcs,i] = optional
123123
} else {
124-
args_min++
124+
args_min++
125125
}
126+
spec_str = spec_str spec_map[arg_type]
126127

127128
if (x = gobble("\\[")) {
128-
if (!spec_opt) {
129-
spec_str = spec_str "|"
130-
spec_opt = 1
131-
}
132129
optional++
133130
}
134131

@@ -180,13 +177,17 @@ END {
180177
" <funcprototype>\n" \
181178
" <funcdef>" types[i] " <function>" funcs[i] "</function></funcdef>\n"
182179

183-
fetchargs = "\tif (zend_parse_parameters(ZEND_NUM_ARGS(), " specs[i] ", "
180+
fetchargs = "\tif (zend_parse_parameters("
181+
if (spec_opt) {
182+
ints = ints "\tint argc = ZEND_NUM_ARGS();\n"
183+
fetchargs = fetchargs "argc"
184+
} else
185+
fetchargs = fetchargs "ZEND_NUM_ARGS()"
186+
fetchargs = fetchargs ", " specs[i]
184187

185188
for (j = 0; j < maxargs[i]; j++) {
186189

187-
if (j) {
188-
fetchargs = fetchargs ", "
189-
}
190+
fetchargs = fetchargs ", "
190191

191192
fetchargs = fetchargs "&" argnames[i,j]
192193
if (argtypes[i,j] == "string") {

0 commit comments

Comments
 (0)