提交 2be22ca5 编写于 作者: J Jes Sorensen 提交者: Kevin Wolf

strtosz(): Use suffix macros in switch() statement

Signed-off-by: NJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 7eb05349
...@@ -324,26 +324,26 @@ int64_t strtosz_suffix(const char *nptr, char **end, const char default_suffix) ...@@ -324,26 +324,26 @@ int64_t strtosz_suffix(const char *nptr, char **end, const char default_suffix)
} }
} }
switch (qemu_toupper(d)) { switch (qemu_toupper(d)) {
case 'B': case STRTOSZ_DEFSUFFIX_B:
mul = 1; mul = 1;
if (mul_required) { if (mul_required) {
goto fail; goto fail;
} }
break; break;
case 'K': case STRTOSZ_DEFSUFFIX_KB:
mul = 1 << 10; mul = 1 << 10;
break; break;
case 0: case 0:
if (mul_required) { if (mul_required) {
goto fail; goto fail;
} }
case 'M': case STRTOSZ_DEFSUFFIX_MB:
mul = 1ULL << 20; mul = 1ULL << 20;
break; break;
case 'G': case STRTOSZ_DEFSUFFIX_GB:
mul = 1ULL << 30; mul = 1ULL << 30;
break; break;
case 'T': case STRTOSZ_DEFSUFFIX_TB:
mul = 1ULL << 40; mul = 1ULL << 40;
break; break;
default: default:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册