diff options
author | Markus Armbruster <armbru@redhat.com> | 2017-02-21 21:13:58 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2017-02-23 20:35:36 +0100 |
commit | d2734d2629266006b0413433778474d5801c60be (patch) | |
tree | d02a4013292c549a001879034250be87fcb9b644 /target | |
parent | 0b742797aaada3a2e243175a69d542d2ed997aac (diff) |
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 'target')
-rw-r--r-- | target/i386/cpu.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/target/i386/cpu.c b/target/i386/cpu.c index fd7add2521..685ca36640 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -2036,8 +2036,7 @@ static void x86_cpu_parse_featurestr(const char *typename, char *features, int64_t tsc_freq; char *err; - tsc_freq = qemu_strtosz_suffix_unit(val, &err, - QEMU_STRTOSZ_DEFSUFFIX_B, 1000); + tsc_freq = qemu_strtosz_metric(val, &err); if (tsc_freq < 0 || *err) { error_setg(errp, "bad numerical value %s", val); return; |