All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ricardo Koller <ricarkol@google.com>
To: Andrew Jones <drjones@redhat.com>
Cc: kvm@vger.kernel.org, lvivier@redhat.com, thuth@redhat.com
Subject: Re: [PATCH kvm-unit-tests] parse_keyval: Allow hex vals
Date: Fri, 8 Oct 2021 09:40:18 -0700	[thread overview]
Message-ID: <YWB0cgmSyLg3LmLe@google.com> (raw)
In-Reply-To: <20211008070309.84205-1-drjones@redhat.com>

On Fri, Oct 08, 2021 at 09:03:09AM +0200, Andrew Jones wrote:
> When parse_keyval was first written we didn't yet have strtol.
> Now we do, let's give users more flexibility.
> 
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
>  lib/util.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/util.c b/lib/util.c
> index a90554138952..682ca2db09e6 100644
> --- a/lib/util.c
> +++ b/lib/util.c
> @@ -4,6 +4,7 @@
>   * This work is licensed under the terms of the GNU LGPL, version 2.
>   */
>  #include <libcflat.h>
> +#include <stdlib.h>
>  #include "util.h"
>  
>  int parse_keyval(char *s, long *val)
> @@ -14,6 +15,6 @@ int parse_keyval(char *s, long *val)
>  	if (!p)
>  		return -1;
>  
> -	*val = atol(p+1);
> +	*val = strtol(p+1, NULL, 0);
>  	return p - s;
>  }
> -- 
> 2.31.1
> 

Reviewed-by: Ricardo Koller <ricarkol@google.com>

  parent reply	other threads:[~2021-10-08 16:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-08  7:03 [PATCH kvm-unit-tests] parse_keyval: Allow hex vals Andrew Jones
2021-10-08  7:06 ` Thomas Huth
2021-10-08 16:40 ` Ricardo Koller [this message]
2021-10-08 19:29 ` Laurent Vivier

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=YWB0cgmSyLg3LmLe@google.com \
    --to=ricarkol@google.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=lvivier@redhat.com \
    --cc=thuth@redhat.com \
    /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.