]> git.proxmox.com Git - qemu.git/commitdiff
strtosz() use qemu_toupper() to simplify switch statement
authorJes Sorensen <Jes.Sorensen@redhat.com>
Mon, 24 Jan 2011 15:33:29 +0000 (16:33 +0100)
committerKevin Wolf <kwolf@redhat.com>
Mon, 31 Jan 2011 09:03:00 +0000 (10:03 +0100)
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
cutils.c

index a067cf45b3d0fb47c01318cff9723eb8789bedc6..78d35e23caa70979d31b17e51d20ce9ea7e39b03 100644 (file)
--- 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: