[X2Go-Commits] [libx2goclient] 21/132: src/x2goclient-network-ssh.c: add array validity check to x2goclient_network_ssh_gptrarray_print_debug ().

git-admin at x2go.org git-admin at x2go.org
Fri Dec 3 15:26:29 CET 2021


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

x2go pushed a commit to branch master
in repository libx2goclient.

commit 4f4931e256c4f8e9e7b71e906667cbb545675925
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Thu Feb 25 10:03:56 2021 +0100

    src/x2goclient-network-ssh.c: add array validity check to x2goclient_network_ssh_gptrarray_print_debug ().
    
    Though redundant, because a later function will check for its validity again, we can still break out early and reduce the needed work.
---
 src/x2goclient-network-ssh.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/x2goclient-network-ssh.c b/src/x2goclient-network-ssh.c
index 6b2044e..348f712 100644
--- a/src/x2goclient-network-ssh.c
+++ b/src/x2goclient-network-ssh.c
@@ -1268,11 +1268,31 @@ static gboolean x2goclient_network_ssh_gptrarray_to_string (GPtrArray * const ar
 #undef SIZE_LOW_WRAP
 }
 
+/*
+ * x2goclient_network_ssh_gptrarray_print_debug:
+ * @arr: (in) (not optional) (array)
+ *       (element-type (type utf8)): pointer to the #GPtrArray to print.
+ * @prelude: (in) (nullable): initial string to prepend to the resulting
+ *                            output.
+ * @desc: (in) (nullable): description of the array to be printed, used in
+ *                         case of errors.
+ *
+ * Prints a #GPtrArray passed as @arr to the debug log level, optionally
+ * prefixing it with @prelude.
+ *
+ * This function internally calls
+ * x2goclient_network_ssh_gptrarray_to_string(), refer to that function to
+ * determine acceptable parameters for @arr.
+ *
+ * Since: 0.0.5
+ */
 static void x2goclient_network_ssh_gptrarray_print_debug (GPtrArray * const arr, const gchar * const prelude, const gchar * const desc) {
   gchar *arr_str = NULL;
   const gchar *def_desc = "unspecified pointer array";
   const gchar *real_desc = def_desc;
 
+  g_return_if_fail (arr);
+
   if (desc) {
     real_desc = desc;
   }

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/libx2goclient.git


More information about the x2go-commits mailing list