From 61cbc8a3f5aa1b4acb4e5a6b7b251b8c5b8f05b5 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Sat, 28 Jan 2017 12:39:30 +0100 Subject: lib/strutils: return end pointer by isdigit_string() Signed-off-by: Karel Zak --- lib/strutils.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/strutils.c b/lib/strutils.c index d3daa369d..74c850bce 100644 --- a/lib/strutils.c +++ b/lib/strutils.c @@ -174,21 +174,26 @@ int strtosize(const char *str, uintmax_t *res) return parse_size(str, res, NULL); } -int isdigit_string(const char *str) +int isdigit_strend(const char *str, const char **end) { const char *p; for (p = str; p && *p && isdigit((unsigned char) *p); p++); + if (end) + *end = p; return p && p > str && !*p; } -int isxdigit_string(const char *str) +int isxdigit_strend(const char *str, const char **end) { const char *p; for (p = str; p && *p && isxdigit((unsigned char) *p); p++); + if (end) + *end = p; + return p && p > str && !*p; } -- cgit v1.2.3-55-g7522