Skip to content

Commit

Permalink
cutils: add qemu_strtoi & qemu_strtoui parsers for int/unsigned int t…
Browse files Browse the repository at this point in the history
…ypes

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>
  • Loading branch information
berrange committed Mar 13, 2018
1 parent 63bab2b commit 473a2a3
Show file tree
Hide file tree
Showing 3 changed files with 770 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/qemu/cutils.h
Expand Up @@ -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,
Expand Down

0 comments on commit 473a2a3

Please sign in to comment.