[X2Go-Commits] [libx2goclient] 02/132: src/x2goclient-utils.{c, h}: add new function x2goclient_bool_to_str ().

git-admin at x2go.org git-admin at x2go.org
Fri Dec 3 15:26:28 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 ca7901552ac78b8243cb20ac014c925141f3a3f6
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Fri Oct 30 05:16:36 2020 +0100

    src/x2goclient-utils.{c,h}: add new function x2goclient_bool_to_str ().
    
    Does pretty much what is written on the box.
---
 src/x2goclient-utils.c | 18 ++++++++++++++++++
 src/x2goclient-utils.h |  1 +
 2 files changed, 19 insertions(+)

diff --git a/src/x2goclient-utils.c b/src/x2goclient-utils.c
index 6ef4c1e..456dc41 100644
--- a/src/x2goclient-utils.c
+++ b/src/x2goclient-utils.c
@@ -229,3 +229,21 @@ gchar* x2goclient_strbrk_dup (gchar * restrict * const haystack, const char need
 
   return (ret);
 }
+
+/**
+ * x2goclient_bool_to_str:
+ * @in: (in): input boolean
+ *
+ * Takes a boolean and converts it to a (static) string.
+ *
+ * Returns: (transfer none): the converted value as a string
+ */
+gchar* x2goclient_bool_to_str (const gboolean in) {
+  gchar *ret = "false";
+
+  if (in) {
+    ret = "true";
+  }
+
+  return (ret);
+}
diff --git a/src/x2goclient-utils.h b/src/x2goclient-utils.h
index a626cbf..6ea340b 100644
--- a/src/x2goclient-utils.h
+++ b/src/x2goclient-utils.h
@@ -53,6 +53,7 @@ void x2goclient_clear_strings (gpointer const data);
 
 long long x2goclient_str_to_int (const gchar * const restrict str, const _Bool min, const long long limit_min, const _Bool max, const long long limit_max, const gchar ** const restrict end, _Bool * const restrict conv_err, _Bool * const restrict min_err, _Bool * const restrict max_err);
 gchar* x2goclient_strbrk_dup (gchar * restrict * const haystack, const char needle, const _Bool free_orig, gsize * const new_size);
+gchar* x2goclient_bool_to_str (const gboolean in);
 
 G_END_DECLS
 

--
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