diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2017-12-22 12:46:23 +0000 |
---|---|---|
committer | Daniel P. Berrangé <berrange@redhat.com> | 2018-03-13 18:06:05 +0000 |
commit | 473a2a331ee382703f7ca0067ba2545350cfa06c (patch) | |
tree | 4c1eef0279b4a65ff55c20ec0b39d6c09fc8aefa /include | |
parent | 63bab2b69688dee0ddadff7449143830e59567cd (diff) | |
download | qemu-473a2a331ee382703f7ca0067ba2545350cfa06c.zip qemu-473a2a331ee382703f7ca0067ba2545350cfa06c.tar.gz qemu-473a2a331ee382703f7ca0067ba2545350cfa06c.tar.bz2 |
cutils: add qemu_strtoi & qemu_strtoui parsers for int/unsigned int types
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 <eblake@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/qemu/cutils.h | 4 |
1 files changed, 4 insertions, 0 deletions
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, |