Messages in this thread |  | | | Date | Tue, 5 Jan 2010 20:13:06 +0100 | | From | Wolfram Sang <> | | Subject | Re: [PATCH 2/2] tracing/recordmount.pl: use apropriate perl-constructs |
| |
> > -$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 == ''); > > # 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?
Regards,
Wolfram
-- Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |[unhandled content-type:application/pgp-signature] |  |