[PATCH 1/2] qemu: command: Remove qemuNetworkDriveGetPort

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

 



Now that the function is only parsing the string to a number, move it's
contents to the only caller.
---
 src/qemu/qemu_command.c | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6ac26af3e..b994940a2 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -491,22 +491,6 @@ qemuSafeSerialParamValue(const char *value)
 }


-static int
-qemuNetworkDriveGetPort(const char *port)
-{
-    int ret = 0;
-
-    if (virStrToLong_i(port, NULL, 10, &ret) < 0 || ret < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("failed to parse port number '%s'"),
-                       port);
-        return -1;
-    }
-
-    return ret;
-}
-
-
 /**
  * qemuBuildSecretInfoProps:
  * @secinfo: pointer to the secret info object
@@ -825,8 +809,13 @@ qemuBuildNetworkDriveURI(virStorageSourcePtr src,
         goto cleanup;

     if (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP) {
-        if ((uri->port = qemuNetworkDriveGetPort(src->hosts->port)) < 0)
+        if (virStrToLong_i(src->hosts->port, NULL, 10, &uri->port) < 0 ||
+            uri->port < 0) {
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("failed to parse port number '%s'"),
+                           src->hosts->port);
             goto cleanup;
+        }

         if (VIR_STRDUP(uri->scheme,
                        virStorageNetProtocolTypeToString(src->protocol)) < 0)
-- 
2.13.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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