[libvirt PATCH 02/12] conf: change virDomainVirtioNet*Format() to return void

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

 



All three of these functions could only return 0 anyway, so just get
rid of all the extra red tape.

Signed-off-by: Laine Stump <laine@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0208d330c3..69e3b7be9a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -25317,7 +25317,7 @@ virDomainActualNetDefFormat(virBufferPtr buf,
 }
 
 
-static int
+static void
 virDomainVirtioNetGuestOptsFormat(char **outstr,
                                   virDomainNetDefPtr def)
 {
@@ -25345,11 +25345,10 @@ virDomainVirtioNetGuestOptsFormat(char **outstr,
     virBufferTrim(&buf, " ", -1);
 
     *outstr = virBufferContentAndReset(&buf);
-    return 0;
 }
 
 
-static int
+static void
 virDomainVirtioNetHostOptsFormat(char **outstr,
                                  virDomainNetDefPtr def)
 {
@@ -25385,11 +25384,10 @@ virDomainVirtioNetHostOptsFormat(char **outstr,
     virBufferTrim(&buf, " ", -1);
 
     *outstr = virBufferContentAndReset(&buf);
-    return 0;
 }
 
 
-static int
+static void
 virDomainVirtioNetDriverFormat(char **outstr,
                                virDomainNetDefPtr def)
 {
@@ -25422,7 +25420,6 @@ virDomainVirtioNetDriverFormat(char **outstr,
     virDomainVirtioOptionsFormat(&buf, def->virtio);
 
     *outstr = virBufferContentAndReset(&buf);
-    return 0;
 }
 
 
@@ -25696,15 +25693,13 @@ virDomainNetDefFormat(virBufferPtr buf,
         virBufferEscapeString(buf, "<model type='%s'/>\n",
                               virDomainNetGetModelString(def));
         if (virDomainNetIsVirtioModel(def)) {
-            int rc = 0;
             g_autofree char *str = NULL;
             g_autofree char *gueststr = NULL;
             g_autofree char *hoststr = NULL;
 
-            if (virDomainVirtioNetDriverFormat(&str, def) < 0 ||
-                virDomainVirtioNetGuestOptsFormat(&gueststr, def) < 0 ||
-                virDomainVirtioNetHostOptsFormat(&hoststr, def) < 0)
-                rc = -1;
+            virDomainVirtioNetDriverFormat(&str, def);
+            virDomainVirtioNetGuestOptsFormat(&gueststr, def);
+            virDomainVirtioNetHostOptsFormat(&hoststr, def);
 
             if (!gueststr && !hoststr) {
                 if (str)
@@ -25722,9 +25717,6 @@ virDomainNetDefFormat(virBufferPtr buf,
                 virBufferAdjustIndent(buf, -2);
                 virBufferAddLit(buf, "</driver>\n");
             }
-
-            if (rc < 0)
-                return -1;
         }
     }
     if (def->backend.tap || def->backend.vhost) {
-- 
2.24.1





[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