[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] warnings: Add gl_WARN_COMPLEMENT and gl_WARN_SUPPORTED.
From: |
Ralf Wildenhues |
Subject: |
Re: [PATCH] warnings: Add gl_WARN_COMPLEMENT and gl_WARN_SUPPORTED. |
Date: |
Mon, 17 Nov 2008 18:25:26 +0100 |
User-agent: |
Mutt/1.5.17+20080114 (2008-01-14) |
Hi Simon,
* Simon Josefsson wrote on Mon, Nov 17, 2008 at 05:45:46PM CET:
> +AC_DEFUN([gl_WARN_COMPLEMENT],
> +[
> + FOO=
> + set -- "$2"
'set --' is told to not be fully portable. Why don't you allow
word-splitting $2 here, so that ...
> + for w in $_; do
... here, you don't have to use unportable (at least not Posix) $_.
> + case "$3" in
> + *" $w "* | *" $w" | "$w "*)
Can be simplified.
In total, portable, faster, and shorter:
FOO=
set x $2
shift
for w
do
case " $3 " in
*" $w "*) ...
And yes, for portability it is necessary that the "for w" and the "do"
are separated by a newline, and no semi-colon.
And I would not use FOO nor w as variables; the global name space comes
with a cost. gl_set and gl_item come to mind.
> + ;;
> + *)
> + FOO="$FOO $w"
> + ;;
> + esac
> + done
> + $1=$FOO
> +])
HTH.
Cheers,
Ralf