[PATCH 5/7] virnetdevvlan: Fix return type of virNetDevVlanEqual()

Michal Privoznik via Devel posted 7 patches 3 months, 3 weeks ago
[PATCH 5/7] virnetdevvlan: Fix return type of virNetDevVlanEqual()
Posted by Michal Privoznik via Devel 3 months, 3 weeks ago
From: Michal Privoznik <mprivozn@redhat.com>

The virNetDevVlanEqual() function is declared to return an int
but in fact its return type is a boolean. Even its only caller
(qemuDomainChangeNet()) threads its retval as a boolean. Switch
the return type from integer to boolean.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/util/virnetdevvlan.c | 2 +-
 src/util/virnetdevvlan.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/virnetdevvlan.c b/src/util/virnetdevvlan.c
index b0e05d8ffe..453b8d0ac9 100644
--- a/src/util/virnetdevvlan.c
+++ b/src/util/virnetdevvlan.c
@@ -41,7 +41,7 @@ virNetDevVlanFree(virNetDevVlan *vlan)
     g_free(vlan);
 }
 
-int
+bool
 virNetDevVlanEqual(const virNetDevVlan *a, const virNetDevVlan *b)
 {
     int ai, bi;
diff --git a/src/util/virnetdevvlan.h b/src/util/virnetdevvlan.h
index fd2f8023f5..59f7fa523d 100644
--- a/src/util/virnetdevvlan.h
+++ b/src/util/virnetdevvlan.h
@@ -41,7 +41,7 @@ struct _virNetDevVlan {
 
 void virNetDevVlanClear(virNetDevVlan *vlan);
 void virNetDevVlanFree(virNetDevVlan *vlan);
-int virNetDevVlanEqual(const virNetDevVlan *a, const virNetDevVlan *b);
+bool virNetDevVlanEqual(const virNetDevVlan *a, const virNetDevVlan *b);
 void virNetDevVlanCopy(virNetDevVlan *dst, const virNetDevVlan *src);
 
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetDevVlan, virNetDevVlanFree);
-- 
2.49.0
Re: [PATCH 5/7] virnetdevvlan: Fix return type of virNetDevVlanEqual()
Posted by Peter Krempa via Devel 3 months, 3 weeks ago
On Wed, May 14, 2025 at 16:24:14 +0200, Michal Privoznik via Devel wrote:
> From: Michal Privoznik <mprivozn@redhat.com>
> 
> The virNetDevVlanEqual() function is declared to return an int
> but in fact its return type is a boolean. Even its only caller
> (qemuDomainChangeNet()) threads its retval as a boolean. Switch

treats

> the return type from integer to boolean.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/util/virnetdevvlan.c | 2 +-
>  src/util/virnetdevvlan.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>