All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH kvm-unit-tests] parse_keyval: Allow hex vals
@ 2021-10-08  7:03 Andrew Jones
  2021-10-08  7:06 ` Thomas Huth
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrew Jones @ 2021-10-08  7:03 UTC (permalink / raw)
  To: kvm; +Cc: lvivier, thuth, ricarkol

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH kvm-unit-tests] parse_keyval: Allow hex vals
  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
  2021-10-08 19:29 ` Laurent Vivier
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2021-10-08  7:06 UTC (permalink / raw)
  To: Andrew Jones, kvm; +Cc: lvivier, ricarkol

On 08/10/2021 09.03, 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;
>   }
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH kvm-unit-tests] parse_keyval: Allow hex vals
  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
  2021-10-08 19:29 ` Laurent Vivier
  2 siblings, 0 replies; 4+ messages in thread
From: Ricardo Koller @ 2021-10-08 16:40 UTC (permalink / raw)
  To: Andrew Jones; +Cc: kvm, lvivier, thuth

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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH kvm-unit-tests] parse_keyval: Allow hex vals
  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
@ 2021-10-08 19:29 ` Laurent Vivier
  2 siblings, 0 replies; 4+ messages in thread
From: Laurent Vivier @ 2021-10-08 19:29 UTC (permalink / raw)
  To: Andrew Jones, kvm; +Cc: thuth, ricarkol

On 08/10/2021 09:03, 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;
>   }
> 
Reviewed-by: Laurent Vivier <lvivier@redhat.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-08 19:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2021-10-08 19:29 ` Laurent Vivier

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.