[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Avoid using grep in func_lalib_p
From: |
Ralf Wildenhues |
Subject: |
Re: Avoid using grep in func_lalib_p |
Date: |
Thu, 24 Apr 2008 08:13:17 +0200 |
User-agent: |
Mutt/1.5.17+20080114 (2008-01-14) |
Hi Olly,
* Olly Betts wrote on Thu, Apr 24, 2008 at 08:04:03AM CEST:
> I noticed that the sed and grep combination in func_lalib_p can be
> folded into a single use of sed. I don't think this is likely to
> be a hot spot, but it's an easy fix.
>
> I'm not an expert on sed portability but it doesn't seem to fall afoul
> of anything in the autoconf manual.
Two things: sed Q is nonportable, it's a GNU extension.
Also, proprietary seds typically don't barf with a script of 4q whatever
their input (binary, really long lines). We don't like generating
needless core files.
So thanks for the patch, but no, unfortunately not acceptable.
Cheers,
Ralf
> --- a/libltdl/config/ltmain.m4sh
> +++ b/libltdl/config/ltmain.m4sh
> @@ -451,8 +451,8 @@ $opt_help || {
> # determined imposters.
> func_lalib_p ()
> {
> - $SED -e 4q "$1" 2>/dev/null \
> - | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
> + lalip_p=`$SED "/^# Generated by .*$PACKAGE/q;4Q;d" "$1" 2> /dev/null`
> + test -n "$lalip_p"
> }
>
> # func_lalib_unsafe_p file