Skip to content

Commit 90510fd

Browse files
committed
ExtUtils::ParseXS: partially eliminate cond field
This object field was being used for two purposes: once to maintain state about CASE conditions, and once as a short-lived temporary value. Use a lexical var instead for the latter use. The new scope will be re-indented in the next commit.
1 parent 78147f3 commit 90510fd

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@ BEGIN {
300300
# aren't being used for this XSUB.
301301

302302
'cond', # Most recent CASE string.
303-
# Also used temporarily elsewhere.
304303

305304
'condnum', # number of CASE keywords encountered.
306305
# Zero indicates none encountered yet.
@@ -1170,16 +1169,20 @@ EOF
11701169
# dXSFUNCTION($self->{ret_type});
11711170
EOF
11721171

1173-
$self->{cond} = set_cond($seen_ellipsis, $min_arg_count, $args_count);
1172+
1173+
{
1174+
# the code to emit to determine whether the correct number of argument
1175+
# have been passed
1176+
my $condition_code = set_cond($seen_ellipsis, $min_arg_count, $args_count);
11741177

11751178
print Q(<<"EOF") if $self->{except}; # "-except" cmd line switch
11761179
# char errbuf[1024];
11771180
# *errbuf = '\\0';
11781181
EOF
11791182

1180-
if($self->{cond}) {
1183+
if ($condition_code) {
11811184
print Q(<<"EOF");
1182-
# if ($self->{cond})
1185+
# if ($condition_code)
11831186
# croak_xs_usage(cv, "$report_args");
11841187
EOF
11851188
}
@@ -1190,6 +1193,7 @@ EOF
11901193
# PERL_UNUSED_VAR(items); /* -W */
11911194
EOF
11921195
}
1196+
}
11931197

11941198
# gcc -Wall: if an XSUB has PPCODE, it is possible that none of ST,
11951199
# XSRETURN or XSprePUSH macros are used. Hence 'ax' (setup by

0 commit comments

Comments
 (0)