Coming back to this code after nearly two months, I realized that the
analysis I posted on Nov 05 was slightly inaccurate, though its main
point -- that the control flow of auto::gc is peculiar and confusing --
is still correct.

As currently structured, the control flow inside this step's runstep()
method looks like this:

if (! defined $gc) {
    $gc = 'gc';
} elsif ( $gc eq 'libc') {
    # set the 'malloc_header' attribute
} else {
    # no 'else' defined
}

.... then ....

if ( $gc =~ /^malloc(?:-trace)?$/ ) {
    # handle the 'malloc' and 'malloc-trace' options
} elsif ( $gc eq 'libc' ) {
    # set some *more* attributes
} else {
    $gc = 'gc';
    # handle this case
}

As you can see, we handle the case of $gc eq 'libc' twice.  This has got
to be wrong.  If $gc eq 'libc', then it cannot match the malloc-trace
regex ... in which case setting the malloc_header can be done in the 2nd
elsif stanza and we can reduce the top 'if' block to:

$gc = 'gc if not defined $gc;

Correct?  Or am I not seeing something?

Thank you very much.

kid51

Reply via email to