Commit a2afc2c1 authored by Jes Sorensen's avatar Jes Sorensen Committed by Kevin Wolf
Browse files

strtosz() use qemu_toupper() to simplify switch statement



Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent f3bd362a
......@@ -323,16 +323,14 @@ int64_t strtosz_suffix(const char *nptr, char **end, const char default_suffix)
d = c;
}
}
switch (d) {
switch (qemu_toupper(d)) {
case 'B':
case 'b':
mul = 1;
if (mul_required) {
goto fail;
}
break;
case 'K':
case 'k':
mul = 1 << 10;
break;
case 0:
......@@ -340,15 +338,12 @@ int64_t strtosz_suffix(const char *nptr, char **end, const char default_suffix)
goto fail;
}
case 'M':
case 'm':
mul = 1ULL << 20;
break;
case 'G':
case 'g':
mul = 1ULL << 30;
break;
case 'T':
case 't':
mul = 1ULL << 40;
break;
default:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment