Re: [PATCH v2 5/8] domain_conf: extend switch with if in virDomainChrDefFree()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



sorry for the confusing commit message, it should have been "domain_conf: extend switch in virDomainChrDefFree()" only:D

Kristina

On Thu, Jul 21, 2022 at 12:46 PM Kristina Hanicova <khanicov@xxxxxxxxxx> wrote:
Switch is used for just one case, but a more future proof
approach is to handle all enum values.

Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b903dac1cb..41eb105a6c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2904,7 +2904,7 @@ void virDomainChrDefFree(virDomainChrDef *def)
     if (!def)
         return;

-    switch (def->deviceType) {
+    switch ((virDomainChrDeviceType)def->deviceType) {
     case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL:
         switch (def->targetType) {
         case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD:
@@ -2918,7 +2918,10 @@ void virDomainChrDefFree(virDomainChrDef *def)
         }
         break;

-    default:
+    case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL:
+    case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL:
+    case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE:
+    case VIR_DOMAIN_CHR_DEVICE_TYPE_LAST:
         break;
     }

--
2.35.3


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux