parse_keyval: Allow hex vals
Subsystems (2)
PATCH 1/1 parse_keyval: Allow hex vals
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 <[email protected]>
--- lib/util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/util.c +2 -1
@@ -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; }
Signature · 1 line
2.31.1
Quoted 22 lines · Andrew Jones
When
parse_keyvalwas first written we didn't yet have strtol. Now we do, let's give users more flexibility.Signed-off-by Andrew Jones <[email protected]>--- lib/util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)lib/util.c +1
-0@@ -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)
lib/util.c int parse_keyval(char *s, long *val) · line 20
Quoted 7 lines
lib/util.c +1
-1@@ -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 <[email protected]>
Quoted 31 lines · Andrew Jones
When
parse_keyvalwas first written we didn't yet have strtol. Now we do, let's give users more flexibility.Signed-off-by Andrew Jones <[email protected]>--- lib/util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)lib/util.c +2
-1@@ -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; }Signature · 1 line
2.31.1
Reviewed-by Ricardo Koller <[email protected]>
Quoted 22 lines · Andrew Jones
When
parse_keyvalwas first written we didn't yet have strtol. Now we do, let's give users more flexibility.Signed-off-by Andrew Jones <[email protected]>--- lib/util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)lib/util.c +1
-0@@ -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)
lib/util.c int parse_keyval(char *s, long *val) · line 20
Quoted 7 lines
lib/util.c +1
-1@@ -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 <[email protected]>