This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository libx2goclient.

commit 270b3f5667a872e7148d1e1ef82f462604f59950
Author: Mihai Moldovan <io...@ionic.de>
Date:   Wed Jul 29 11:41:55 2020 +0200

    src/x2goclient-network-ssh.c: split out array printing routine into its own 
function.
    
    We could probably use it in multiple places.
---
 src/x2goclient-network-ssh.c | 63 +++++++++++++++++++++++++-------------------
 1 file changed, 36 insertions(+), 27 deletions(-)

diff --git a/src/x2goclient-network-ssh.c b/src/x2goclient-network-ssh.c
index 32d92cd..feab49c 100644
--- a/src/x2goclient-network-ssh.c
+++ b/src/x2goclient-network-ssh.c
@@ -134,6 +134,7 @@ static gboolean x2goclient_network_ssh_kill_subprocesses 
(X2GoClientNetworkSSH *
 static gboolean x2goclient_network_ssh_parent_connect (X2GoClientNetwork 
*parent, GError **gerr);
 static gboolean x2goclient_network_ssh_fetch_openssh_version 
(X2GoClientNetworkSSH *self, GError **gerr);
 static void x2goclient_network_ssh_log_std_str (const gchar * const str, const 
gsize str_size, const _Bool select_stderr);
+static void x2goclient_network_ssh_ptrarray_print (GPtrArray * const arr, 
const gchar * const prelude);
 
 
 static void x2goclient_network_ssh_class_init (X2GoClientNetworkSSHClass 
*klass) {
@@ -950,33 +951,7 @@ static gboolean x2goclient_network_ssh_parent_connect 
(X2GoClientNetwork *parent
   }
 
   if (ret) {
-    {
-      /*
-       * Yeah, this is potentially slow, but there is no better way to use
-       * g_log ().
-       */
-      gchar *tmp = g_strdup ("Would try to connect via:");
-      for (gsize i = 0; i < ssh_cmd->len; ++i) {
-        gchar *tmp_new = NULL;
-        gchar *cur_entry = (gchar *)g_ptr_array_index (ssh_cmd, i);
-        const gchar *empty = "(NULL)";
-
-        if (cur_entry) {
-          tmp_new = g_strdup_printf ("%s [%s]", tmp, cur_entry);
-        }
-        else {
-          tmp_new = g_strdup_printf ("%s [%s]", tmp, empty);
-        }
-
-        g_free (tmp);
-
-        tmp = tmp_new;
-      }
-      g_log (NULL, G_LOG_LEVEL_DEBUG, "%s", tmp);
-
-      g_free (tmp);
-      tmp = NULL;
-    }
+    x2goclient_network_ssh_gptrarray_print (ssh_cmd, "Would try to connect 
via:");
 
     g_log (NULL, G_LOG_LEVEL_DEBUG, "Launching!");
     GError *ssh_err = NULL;
@@ -1125,3 +1100,37 @@ static void x2goclient_network_ssh_log_std_str (const 
gchar * const str, const g
     g_log (NULL, G_LOG_LEVEL_DEBUG, "Std%s: no data", stream);
   }
 }
+
+static void x2goclient_network_ssh_gptrarray_print (GPtrArray * const arr, 
const gchar * const prelude) {
+  g_return_if_fail (arr);
+
+  /*
+   * Yeah, this is potentially slow, but there is no better way to use
+   * g_log ().
+   */
+  gchar *tmp = NULL;
+  const gchar *empty = "(NULL)";
+  if (prelude) {
+    tmp = g_strdup (prelude);
+  }
+
+  for (gsize i = 0; i < arr->len; ++i) {
+    gchar *tmp_new = NULL;
+    gchar *cur_entry = (gchar *)g_ptr_array_index (arr, i);
+
+    if (cur_entry) {
+      tmp_new = g_strdup_printf ("%s [%s]", tmp, cur_entry);
+    }
+    else {
+      tmp_new = g_strdup_printf ("%s [%s]", tmp, empty);
+    }
+
+    g_free (tmp);
+
+    tmp = tmp_new;
+  }
+  g_log (NULL, G_LOG_LEVEL_DEBUG, "%s", tmp);
+
+  g_free (tmp);
+  tmp = NULL;
+}

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on 
/srv/git/code.x2go.org/libx2goclient.git
_______________________________________________
x2go-commits mailing list
x2go-commits@lists.x2go.org
https://lists.x2go.org/listinfo/x2go-commits

Reply via email to