summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarel Zak2017-01-28 12:39:30 +0100
committerKarel Zak2017-01-28 12:39:30 +0100
commit61cbc8a3f5aa1b4acb4e5a6b7b251b8c5b8f05b5 (patch)
treec0d1ce4f8391dd496d760417c1174e7d27ac2100 /lib
parentlibfdisk: (gpt) add check for entries array size (diff)
downloadkernel-qcow2-util-linux-61cbc8a3f5aa1b4acb4e5a6b7b251b8c5b8f05b5.tar.gz
kernel-qcow2-util-linux-61cbc8a3f5aa1b4acb4e5a6b7b251b8c5b8f05b5.tar.xz
kernel-qcow2-util-linux-61cbc8a3f5aa1b4acb4e5a6b7b251b8c5b8f05b5.zip
lib/strutils: return end pointer by isdigit_string()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/strutils.c9
1 files changed, 7 insertions, 2 deletions
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;
}