Re: [PATCH 2/2] tracing/recordmount.pl: use apropriateperl-constructs

From: Steven Rostedt
Date: Tue Jan 05 2010 - 14:24:24 EST


On Tue, 2010-01-05 at 20:13 +0100, Wolfram Sang wrote:
> > > -$objdump = "objdump" if ((length $objdump) == 0);
> > > -$objcopy = "objcopy" if ((length $objcopy) == 0);
> > > -$cc = "gcc" if ((length $cc) == 0);
> > > -$ld = "ld" if ((length $ld) == 0);
> > > -$nm = "nm" if ((length $nm) == 0);
> > > -$rm = "rm" if ((length $rm) == 0);
> > > -$mv = "mv" if ((length $mv) == 0);
> > > +$objdump ||= 'objdump';
> > > +$objcopy ||= 'objcopy';
> > > +$cc ||= 'gcc';
> > > +$ld ||= 'ld';
> > > +$nm ||= 'nm';
> > > +$rm ||= 'rm';
> > > +$mv ||= 'mv';
> >
> > I purposely did not do it this way (I need to add a comment about this),
> > because most kernel developers are not perl programmers, and I wanted
> > this to be as easy as possible for a non-perl programmer to understand.
> >
> > Even as a perl programmer it still looks funny to me with the:
> >
> >
> > $x ||= 'x';
> >
>
> Yes, okay, it's an idiom one needs to know. While your point "be C-compatible"
> makes also sense to me (comment would be nice indeed), this should do it, too?
>
> $cc = "gcc" if ($cc == '');

Yeah that looks better. You can also add a comment that says that this
code is trying to be C programmer friendly, and avoids the "$x ||= 'x'"
construct. Since this is the second or third time I had to deny that
change ;-)

>
> > > # Shut up recordmcount if user has older objcopy
> > > -my $quiet_recordmcount = ".tmp_quiet_recordmcount";
> > > -my $print_warning = 1;
> > > -$print_warning = 0 if ( -f $quiet_recordmcount);
> > > +my $quiet_recordmcount = '.tmp_quiet_recordmcount';
> > > +my $print_warning = (! -f $quiet_recordmcount);
> >
> > Again, this is just using perl obfuscation for most C programmers to
> > understand.
>
> Okay, mileages... :)
>
> > I fine with this change too.
>
> Shall I resend or will you just pick up the interesting parts?

Yes please resend!

Thanks,


-- Steve


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/