@@ -2404,59 +2404,43 @@ sub INPUT_handler {
2404
2404
2405
2405
my ($init , $no_init , $defer );
2406
2406
2407
- if ( defined $init_op
2408
- and $init_op =~ / ^[=;]$ /
2409
- and $var_init =~ / ^NO_INIT\s *;?\s *$ /
2410
- ) {
2411
- # NO_INIT: skip initialisation
2412
- $no_init = 1;
2413
- }
2414
-
2415
- elsif (defined $init_op ) {
2407
+ if (defined $init_op ) {
2416
2408
# Emit the init code based on overridden $var_init, which was
2417
2409
# preceded by /[=;+]/ which has been extracted into $init_op
2418
2410
2419
- if ($init_op eq ' =' ) {
2411
+ if ( $init_op =~ / ^[=;]$ /
2412
+ and $var_init =~ / ^NO_INIT\s *;?\s *$ /
2413
+ ) {
2414
+ # NO_INIT: skip initialisation
2415
+ $no_init = 1;
2416
+ }
2417
+ elsif ($init_op eq ' =' ) {
2420
2418
# Overridden typemap, such as '= ($type)SvUV($arg)'
2421
2419
$var_init =~ s / ;\s *$// ;
2422
-
2423
2420
$init = $var_init ,
2424
2421
}
2425
2422
else {
2426
2423
# "; extra code" or "+ extra code" :
2427
2424
# append the extra code (after passing through eval) after all the
2428
- # INPUT and PREINIT blocks have been processed, using the
2429
- # $self->{xsub_deferred_code_lines} mechanism.
2430
- # In addition, for '+', also generate the normal initialisation code
2431
- # from the standard typemap - assuming that it's a real parameter
2432
- # that appears in the signature as well as the INPUT line.
2433
-
2434
- # if '+' on a real var, generate init from typemap,
2435
- # else (';' or fake var), skip init.
2425
+ # INPUT and PREINIT blocks have been processed, indirectly using
2426
+ # the $self->{xsub_deferred_code_lines} mechanism.
2427
+ # In addition, for '+', also generate the normal initialisation
2428
+ # code from the standard typemap - assuming that it's a real
2429
+ # parameter that appears in the signature as well as the INPUT
2430
+ # line.
2436
2431
$no_init = !($init_op eq ' +' && !$is_alien );
2437
2432
# But in either case, add the deferred code
2438
- $defer = $var_init ,
2433
+ $defer = $var_init ;
2439
2434
}
2440
2435
}
2441
-
2442
- elsif (!$is_alien ) {
2443
- # Emit var and init code based on typemap entry
2444
- }
2445
2436
else {
2446
- # A parameter which has been declared (with no initialiser) in the
2447
- # INPUT section, but which hasn't also been declared in the XSUB's
2448
- # signature. Should be illegal, but people rely on it,
2449
- # For such a variable, don't use a typemap, because there's no value
2450
- # on the stack to be converted.
2451
- $no_init = 1;
2452
- }
2453
-
2454
- if ( defined $param -> {in_out }
2455
- and $param -> {in_out } =~ / ^OUT/
2456
- and !defined $init_op
2457
- ) {
2458
- # OUT* class: skip initialisation
2459
- $no_init = 1;
2437
+ # no initialiser: emit var and init code based on typemap entry,
2438
+ # unless:
2439
+ # - its alien (so no stack arg to bind to it), or
2440
+ # - its an OUT-only var, so not initialised from the arg
2441
+ $no_init = 1
2442
+ if ( $is_alien
2443
+ or defined $param -> {in_out } and $param -> {in_out } =~ / ^OUT/ )
2460
2444
}
2461
2445
2462
2446
%$param = (
0 commit comments