This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository libx2goclient. commit 02816aa91a796c267d141ca158ccae718a76846c Author: Mihai Moldovan <ionic@ionic.de> Date: Thu May 14 19:45:51 2020 +0200 src/x2goclient-openssh-version.{c,h}: rework x2goclient_openssh_version_parse () to return _Bool. GError is typically optional and passing NULL to it is a valid way to ignore *the specifics* of errors. This said, we still need to have a way to determine whether an error happened or not - and hence, if the parsing was successful. --- src/x2goclient-openssh-version.c | 16 ++++++++++++---- src/x2goclient-openssh-version.h | 4 +++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/x2goclient-openssh-version.c b/src/x2goclient-openssh-version.c index a071938..7f4479a 100644 --- a/src/x2goclient-openssh-version.c +++ b/src/x2goclient-openssh-version.c @@ -115,16 +115,18 @@ G_DEFINE_BOXED_TYPE (X2GoClientOpenSSHVersion, x2goclient_openssh_version, &x2go }\ } while (0) -void x2goclient_openssh_version_parse (X2GoClientOpenSSHVersion *openssh_version, const gchar *version_string, GError **gerr) { +_Bool x2goclient_openssh_version_parse (X2GoClientOpenSSHVersion *openssh_version, const gchar *version_string, GError **gerr) { + _Bool ret = FALSE; + /* Basic sanity checks on struct and string. */ if (!(openssh_version)) { g_set_error_literal (gerr, ERROR_QUARK, X2GOCLIENT_OPENSSH_VERSION_ERROR_INVALID_STRUCT, "No version struct passed, cannot store extracted information."); - return; + return (ret); } if (!(version_string)) { g_set_error_literal (gerr, ERROR_QUARK, X2GOCLIENT_OPENSSH_VERSION_ERROR_INVALID_VERSION_STRING, "No version string passed, cannot extract information."); - return; + return (ret); } X2GoClientOpenSSHVersion *struct_work_copy = x2goclient_openssh_version_copy (openssh_version); @@ -142,7 +144,7 @@ void x2goclient_openssh_version_parse (X2GoClientOpenSSHVersion *openssh_version x2goclient_openssh_version_free (struct_work_copy); struct_work_copy = NULL; - return; + return (ret); } /* Skip preamble. */ @@ -307,8 +309,12 @@ void x2goclient_openssh_version_parse (X2GoClientOpenSSHVersion *openssh_version if (vers_err) { x2goclient_openssh_version_free (struct_work_copy); struct_work_copy = NULL; + + return (ret); } + ret = TRUE; + /* Scan for a comma which should follow any additional version data. */ const gchar *end = g_strstr_len (tmp, -1, ","); if (!(end)) { @@ -340,4 +346,6 @@ void x2goclient_openssh_version_parse (X2GoClientOpenSSHVersion *openssh_version /* Lastly, free data. */ x2goclient_openssh_version_free (struct_work_copy); struct_work_copy = NULL; + + return (ret); } diff --git a/src/x2goclient-openssh-version.h b/src/x2goclient-openssh-version.h index 47f65b4..9c434d3 100644 --- a/src/x2goclient-openssh-version.h +++ b/src/x2goclient-openssh-version.h @@ -25,6 +25,8 @@ #ifndef x2goclient_openssh_version_h #define x2goclient_openssh_version_h +#include <stdbool.h> + #include <glib-object.h> G_BEGIN_DECLS @@ -76,7 +78,7 @@ enum { }; -void x2goclient_openssh_version_parse (X2GoClientOpenSSHVersion *openssh_version, const gchar *version_string, GError **gerr); +_Bool x2goclient_openssh_version_parse (X2GoClientOpenSSHVersion *openssh_version, const gchar *version_string, GError **gerr); G_END_DECLS -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/libx2goclient.git