mirror of
https://github.com/yuzu-mirror/unicorn.git
synced 2026-04-05 06:25:33 +00:00
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. Backports commit d2734d2629266006b0413433778474d5801c60be from qemu
This commit is contained in:
parent
fb962d2e74
commit
f656cd91ec
3 changed files with 11 additions and 7 deletions
|
|
@ -147,8 +147,8 @@ int qemu_strtou64(const char *nptr, const char **endptr, 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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue