All of lore.kernel.org
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Andrea Claudi <aclaudi@redhat.com>
Cc: netdev@vger.kernel.org, stephen@networkplumber.org,
	dsahern@gmail.com, bluca@debian.org
Subject: Re: [PATCH iproute2 v3 1/3] configure: support --param=value style
Date: Wed, 6 Oct 2021 10:09:44 +0200	[thread overview]
Message-ID: <20211006080944.GA32194@orbyte.nwl.cc> (raw)
In-Reply-To: <caa9b65bef41acd51d45e45e1a158edb1eeefe7d.1633455436.git.aclaudi@redhat.com>

Hi Andrea,

A remark regarding coding style:

On Wed, Oct 06, 2021 at 12:08:04AM +0200, Andrea Claudi wrote:
[...]
> diff --git a/configure b/configure
> index 7f4f3bd9..d57ce0f8 100755
> --- a/configure
> +++ b/configure
> @@ -501,18 +501,30 @@ if [ $# -eq 1 ] && [ "$(echo $1 | cut -c 1)" != '-' ]; then
>  else
>  	while true; do
>  		case "$1" in
> -			--include_dir)
> -				INCLUDE=$2
> -				shift 2 ;;
> -			--libbpf_dir)
> -				LIBBPF_DIR="$2"
> -				shift 2 ;;
> -			--libbpf_force)
> -				if [ "$2" != 'on' ] && [ "$2" != 'off' ]; then
> +			--include_dir | --include_dir=*)

So here the code combines the two cases,

> +				INCLUDE="${1#*=}"
> +				if [ "$INCLUDE" == "--include_dir" ]; then

just to fiddle it apart again. Did you consider leaving the old cases in
place and adding separate ones for the --opt=val cases like so:

| 			--include_dir=*)
| 				INCLUDE="${1#*=}"
| 				shift
| 				;;

[...]
> +			--libbpf_force | --libbpf_force=*)
> +				LIBBPF_FORCE="${1#*=}"
> +				if [ "$LIBBPF_FORCE" == "--libbpf_force" ]; then
> +					LIBBPF_FORCE="$2"
> +					shift
> +				fi
> +				if [ "$LIBBPF_FORCE" != 'on' ] && [ "$LIBBPF_FORCE" != 'off' ]; then

To avoid duplication here, I would move semantic checks into a second
step. This would allow for things like:

| --libbpf_force=invalid --libbpf_force=on

but separating the syntactic parsing from semantic checks might be
beneficial by itself, too.

Cheers, Phil

  reply	other threads:[~2021-10-06  8:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05 22:08 [PATCH iproute2 v3 0/3] configure: add support for libdir and prefix option Andrea Claudi
2021-10-05 22:08 ` [PATCH iproute2 v3 1/3] configure: support --param=value style Andrea Claudi
2021-10-06  8:09   ` Phil Sutter [this message]
2021-10-06  9:49     ` Andrea Claudi
2021-10-06 10:18       ` Phil Sutter
2021-10-06 14:27         ` David Ahern
2021-10-05 22:08 ` [PATCH iproute2 v3 2/3] configure: add the --prefix option Andrea Claudi
2021-10-05 22:08 ` [PATCH iproute2 v3 3/3] configure: add the --libdir option Andrea Claudi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211006080944.GA32194@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=aclaudi@redhat.com \
    --cc=bluca@debian.org \
    --cc=dsahern@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.