summaryrefslogtreecommitdiffstats
path: root/include/qemu
diff options
context:
space:
mode:
authorMarkus Armbruster2017-02-21 21:13:58 +0100
committerMarkus Armbruster2017-02-23 20:35:36 +0100
commitd2734d2629266006b0413433778474d5801c60be (patch)
treed02a4013292c549a001879034250be87fcb9b644 /include/qemu
parenttest-cutils: Cover qemu_strtosz() around range limits (diff)
downloadqemu-d2734d2629266006b0413433778474d5801c60be.tar.gz
qemu-d2734d2629266006b0413433778474d5801c60be.tar.xz
qemu-d2734d2629266006b0413433778474d5801c60be.zip
util/cutils: New qemu_strtosz_metric()
To parse numbers with metric suffixes, we use qemu_strtosz_suffix_unit(nptr, &eptr, QEMU_STRTOSZ_DEFSUFFIX_B, 1000) Capture this in a new function for legibility: qemu_strtosz_metric(nptr, &eptr) Replace test_qemu_strtosz_suffix_unit() by test_qemu_strtosz_metric(). Rename qemu_strtosz_suffix_unit() to do_strtosz() and give it internal linkage. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <1487708048-2131-15-git-send-email-armbru@redhat.com>
Diffstat (limited to 'include/qemu')
-rw-r--r--include/qemu/cutils.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h
index f922223f04..81613d01ee 100644
--- a/include/qemu/cutils.h
+++ b/include/qemu/cutils.h
@@ -156,8 +156,8 @@ int parse_uint_full(const char *s, unsigned long long *value, int base);
int64_t qemu_strtosz(const char *nptr, char **end);
int64_t qemu_strtosz_suffix(const char *nptr, char **end,
const char default_suffix);
-int64_t qemu_strtosz_suffix_unit(const char *nptr, char **end,
- const char default_suffix, int64_t unit);
+int64_t qemu_strtosz_metric(const char *nptr, char **end);
+
#define K_BYTE (1ULL << 10)
#define M_BYTE (1ULL << 20)
#define G_BYTE (1ULL << 30)