aboutsummaryrefslogtreecommitdiff
path: root/cutils.c
diff options
context:
space:
mode:
authorJes Sorensen <Jes.Sorensen@redhat.com>2011-01-24 16:33:29 +0100
committerKevin Wolf <kwolf@redhat.com>2011-01-31 10:03:00 +0100
commita2afc2c16339a85176696738e4c58ed4ff36f8b5 (patch)
tree0b0872741671b38abada59faa0caefbc0b931fd7 /cutils.c
parentf3bd362a1857c617a4154062cadd501fc52c4199 (diff)
downloadqemu-a2afc2c16339a85176696738e4c58ed4ff36f8b5.zip
qemu-a2afc2c16339a85176696738e4c58ed4ff36f8b5.tar.gz
qemu-a2afc2c16339a85176696738e4c58ed4ff36f8b5.tar.bz2
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>
Diffstat (limited to 'cutils.c')
-rw-r--r--cutils.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/cutils.c b/cutils.c
index a067cf4..78d35e2 100644
--- a/cutils.c
+++ b/cutils.c
@@ -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: