]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: hostdev: Enforce enum-in-switch compile-time checks
authorErik Skultety <eskultet@redhat.com>
Thu, 9 Mar 2017 09:20:42 +0000 (10:20 +0100)
committerErik Skultety <eskultet@redhat.com>
Mon, 27 Mar 2017 13:39:35 +0000 (15:39 +0200)
Enforce virDomainHostdevSubsysType checking during compilation. Again,
one of a few spots in our code where we should enforce the typecast to
the enum type, thus not forgetting to update *all* switch occurrences
dealing with the give enum.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
src/conf/domain_conf.c

index 6bbc6a2a7b4af2e03c5cfcddafbc682fc3502913..17909820be786ee352223280dc84d04ced9edf8f 100644 (file)
@@ -2320,7 +2320,7 @@ void virDomainHostdevDefClear(virDomainHostdevDefPtr def)
 
     switch (def->mode) {
     case VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES:
-        switch (def->source.caps.type) {
+        switch ((virDomainHostdevCapsType) def->source.caps.type) {
         case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_STORAGE:
             VIR_FREE(def->source.caps.u.storage.block);
             break;
@@ -2331,6 +2331,8 @@ void virDomainHostdevDefClear(virDomainHostdevDefPtr def)
             VIR_FREE(def->source.caps.u.net.ifname);
             virNetDevIPInfoClear(&def->source.caps.u.net.ip);
             break;
+        case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST:
+            break;
         }
         break;
     case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS: