[PATCH v2 5/8] domain_conf: extend switch with if in virDomainChrDefFree()
Kristina Hanicova
khanicov at redhat.com
Thu Jul 21 15:04:43 UTC 2022
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 at redhat.com>
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 at redhat.com>
> ---
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20220721/3aec4ba1/attachment-0001.htm>
More information about the libvir-list
mailing list