strtosz() use qemu_toupper() to simplify switch statement

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Jes Sorensen 2011-01-24 16:33:29 +01:00 committed by Kevin Wolf
parent f3bd362a18
commit a2afc2c163

View File

@ -323,16 +323,14 @@ int64_t strtosz_suffix(const char *nptr, char **end, const char default_suffix)
d = c; d = c;
} }
} }
switch (d) { switch (qemu_toupper(d)) {
case 'B': case 'B':
case 'b':
mul = 1; mul = 1;
if (mul_required) { if (mul_required) {
goto fail; goto fail;
} }
break; break;
case 'K': case 'K':
case 'k':
mul = 1 << 10; mul = 1 << 10;
break; break;
case 0: case 0:
@ -340,15 +338,12 @@ int64_t strtosz_suffix(const char *nptr, char **end, const char default_suffix)
goto fail; goto fail;
} }
case 'M': case 'M':
case 'm':
mul = 1ULL << 20; mul = 1ULL << 20;
break; break;
case 'G': case 'G':
case 'g':
mul = 1ULL << 30; mul = 1ULL << 30;
break; break;
case 'T': case 'T':
case 't':
mul = 1ULL << 40; mul = 1ULL << 40;
break; break;
default: default: