util/cutils: New qemu_strtosz()

Most callers of qemu_strtosz_suffix() pass QEMU_STRTOSZ_DEFSUFFIX_B.
Capture the pattern in new qemu_strtosz().

Inline qemu_strtosz_suffix() into its only remaining caller.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <1487708048-2131-17-git-send-email-armbru@redhat.com>
This commit is contained in:
Markus Armbruster
2017-02-21 21:14:00 +01:00
parent e591591b32
commit 466dea14e6
6 changed files with 30 additions and 41 deletions

View File

@ -140,7 +140,7 @@ static int64_t cvtnum(const char *s)
char *end;
int64_t ret;
ret = qemu_strtosz_suffix(s, &end, QEMU_STRTOSZ_DEFSUFFIX_B);
ret = qemu_strtosz(s, &end);
if (*end != '\0') {
/* Detritus at the end of the string */
return -EINVAL;