diff --git a/qemu/include/qemu/cutils.h b/qemu/include/qemu/cutils.h index ce7243a8..e172aff4 100644 --- a/qemu/include/qemu/cutils.h +++ b/qemu/include/qemu/cutils.h @@ -130,22 +130,8 @@ int qemu_strtoi64(const char *nptr, const char **endptr, int base, int64_t *result); int qemu_strtou64(const char *nptr, const char **endptr, int base, uint64_t *result); -/* - * qemu_strtosz() suffixes used to specify the default treatment of an - * argument passed to qemu_strtosz() without an explicit suffix. - * These should be defined using upper case characters in the range - * A-Z, as qemu_strtosz() will use qemu_toupper() on the given argument - * prior to comparison. - */ -#define QEMU_STRTOSZ_DEFSUFFIX_EB 'E' -#define QEMU_STRTOSZ_DEFSUFFIX_PB 'P' -#define QEMU_STRTOSZ_DEFSUFFIX_TB 'T' -#define QEMU_STRTOSZ_DEFSUFFIX_GB 'G' -#define QEMU_STRTOSZ_DEFSUFFIX_MB 'M' -#define QEMU_STRTOSZ_DEFSUFFIX_KB 'K' -#define QEMU_STRTOSZ_DEFSUFFIX_B 'B' -int64_t qemu_strtosz_suffix(const char *nptr, char **end, - const char default_suffix); + +int64_t qemu_strtosz(const char *nptr, char **end); int64_t qemu_strtosz_MiB(const char *nptr, char **end); int64_t qemu_strtosz_metric(const char *nptr, char **end); diff --git a/qemu/util/cutils.c b/qemu/util/cutils.c index f44b4754..bf5147a5 100644 --- a/qemu/util/cutils.c +++ b/qemu/util/cutils.c @@ -127,6 +127,14 @@ char *qemu_strsep(char **input, const char *delim) return result; } +#define QEMU_STRTOSZ_DEFSUFFIX_EB 'E' +#define QEMU_STRTOSZ_DEFSUFFIX_PB 'P' +#define QEMU_STRTOSZ_DEFSUFFIX_TB 'T' +#define QEMU_STRTOSZ_DEFSUFFIX_GB 'G' +#define QEMU_STRTOSZ_DEFSUFFIX_MB 'M' +#define QEMU_STRTOSZ_DEFSUFFIX_KB 'K' +#define QEMU_STRTOSZ_DEFSUFFIX_B 'B' + static int64_t suffix_mul(char suffix, int64_t unit) { switch (qemu_toupper(suffix)) { @@ -197,15 +205,14 @@ fail: return retval; } -int64_t qemu_strtosz_suffix(const char *nptr, char **end, - const char default_suffix) +int64_t qemu_strtosz(const char *nptr, char **end) { - return do_strtosz(nptr, end, default_suffix, 1024); + return do_strtosz(nptr, end, QEMU_STRTOSZ_DEFSUFFIX_B, 1024); } int64_t qemu_strtosz_MiB(const char *nptr, char **end) { - return qemu_strtosz_suffix(nptr, end, QEMU_STRTOSZ_DEFSUFFIX_MB); + return do_strtosz(nptr, end, QEMU_STRTOSZ_DEFSUFFIX_MB, 1024); } int64_t qemu_strtosz_metric(const char *nptr, char **end)