All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] settings: Parse non-base-10 integer settings
@ 2020-03-25 20:18 Andrew Zaborowski
  2020-03-26 18:15 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Zaborowski @ 2020-03-25 20:18 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 1232 bytes --]

Change the stro{,u}{l,ll} base parameter to 0 to not disallow hex or
octal numbers, useful for bitmasks.
---
 ell/settings.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ell/settings.c b/ell/settings.c
index c5e1184..f4326d6 100644
--- a/ell/settings.c
+++ b/ell/settings.c
@@ -998,7 +998,7 @@ LIB_EXPORT bool l_settings_get_int(const struct l_settings *settings,
 
 	errno = 0;
 
-	t = r = strtol(value, &endp, 10);
+	t = r = strtol(value, &endp, 0);
 	if (*endp != '\0')
 		goto error;
 
@@ -1045,7 +1045,7 @@ LIB_EXPORT bool l_settings_get_uint(const struct l_settings *settings,
 
 	errno = 0;
 
-	t = r = strtoul(value, &endp, 10);
+	t = r = strtoul(value, &endp, 0);
 	if (*endp != '\0')
 		goto error;
 
@@ -1091,7 +1091,7 @@ LIB_EXPORT bool l_settings_get_int64(const struct l_settings *settings,
 
 	errno = 0;
 
-	r = strtoll(value, &endp, 10);
+	r = strtoll(value, &endp, 0);
 	if (*endp != '\0')
 		goto error;
 
@@ -1137,7 +1137,7 @@ LIB_EXPORT bool l_settings_get_uint64(const struct l_settings *settings,
 
 	errno = 0;
 
-	r = strtoull(value, &endp, 10);
+	r = strtoull(value, &endp, 0);
 	if (*endp != '\0')
 		goto error;
 
-- 
2.20.1

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

* Re: [PATCH] settings: Parse non-base-10 integer settings
  2020-03-25 20:18 [PATCH] settings: Parse non-base-10 integer settings Andrew Zaborowski
@ 2020-03-26 18:15 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2020-03-26 18:15 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 304 bytes --]

hi Andrew,

On 3/25/20 3:18 PM, Andrew Zaborowski wrote:
> Change the stro{,u}{l,ll} base parameter to 0 to not disallow hex or
> octal numbers, useful for bitmasks.
> ---
>   ell/settings.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)

Applied, thanks.

Regards,
-Denis

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

end of thread, other threads:[~2020-03-26 18:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-25 20:18 [PATCH] settings: Parse non-base-10 integer settings Andrew Zaborowski
2020-03-26 18:15 ` Denis Kenzior

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.