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


Reply via email to