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

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



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


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