[libvirt] [PATCH] virDomainFormatSchedDef: Initialize @priority

Michal Privoznik mprivozn at redhat.com
Tue Feb 9 08:08:49 UTC 2016


Older gcc fails to see that the variable is set iff @hasPriority
== true in which case the former is set a value. Initialize the
value while declaring it to make the compiler shut up.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---

This maybe isn't the best approach, to workaround false
positives. I'm open to discussion.

 src/conf/domain_conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 895a51b..67415fa 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -21472,7 +21472,7 @@ virDomainFormatSchedDef(virDomainDefPtr def,
             virBitmapPtr currentMap = NULL;
             ssize_t nextprio;
             bool hasPriority = false;
-            int priority;
+            int priority = 0;
 
             switch ((virProcessSchedPolicy) i) {
             case VIR_PROC_POLICY_NONE:
-- 
2.4.10




More information about the libvir-list mailing list