From 473a2a331ee382703f7ca0067ba2545350cfa06c Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Fri, 22 Dec 2017 12:46:23 +0000 Subject: cutils: add qemu_strtoi & qemu_strtoui parsers for int/unsigned int types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are qemu_strtoNN functions for various sized integers. This adds two more for plain int & unsigned int types, with suitable range checking. Reviewed-by: Eric Blake Reviewed-by: Marc-André Lureau Signed-off-by: Daniel P. Berrange --- include/qemu/cutils.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/qemu') diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h index f0878ea..a663340 100644 --- a/include/qemu/cutils.h +++ b/include/qemu/cutils.h @@ -126,6 +126,10 @@ time_t mktimegm(struct tm *tm); int qemu_fdatasync(int fd); int fcntl_setfl(int fd, int flag); int qemu_parse_fd(const char *param); +int qemu_strtoi(const char *nptr, const char **endptr, int base, + int *result); +int qemu_strtoui(const char *nptr, const char **endptr, int base, + unsigned int *result); int qemu_strtol(const char *nptr, const char **endptr, int base, long *result); int qemu_strtoul(const char *nptr, const char **endptr, int base, -- cgit v1.1