summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2022-02-22 16:00:18 +0100
committerAleksander Morgado <aleksander@aleksander.es>2022-02-27 00:25:30 +0100
commit4236aa916e036cb7a496fcf68ad96a808644ec65 (patch)
tree01b674ab124aa6c91679db1e7fe1f6f5e21dcd56 /src
parent10584ccabf698a4b96c92b107348913de081cfd9 (diff)
downloadlibqmi-4236aa916e036cb7a496fcf68ad96a808644ec65.tar.gz
build-aux,codegen: use per-type clear methods
We create new clear methods for each struct type, plus additional generic clear methods for GArrays and strings.
Diffstat (limited to 'src')
-rw-r--r--src/libqmi-glib/qmi-helpers.c18
-rw-r--r--src/libqmi-glib/qmi-helpers.h6
2 files changed, 24 insertions, 0 deletions
diff --git a/src/libqmi-glib/qmi-helpers.c b/src/libqmi-glib/qmi-helpers.c
index d8f1176b..33587faf 100644
--- a/src/libqmi-glib/qmi-helpers.c
+++ b/src/libqmi-glib/qmi-helpers.c
@@ -692,6 +692,24 @@ qmi_helpers_list_links (GFile *sysfs_file,
return TRUE;
}
+/******************************************************************************/
+
+void
+qmi_helpers_clear_string (gchar **value)
+{
+ if (value && *value)
+ g_free (*value);
+}
+
+void
+qmi_helpers_clear_array (GArray **value)
+{
+ if (value && *value)
+ g_array_unref (*value);
+}
+
+/******************************************************************************/
+
#if !GLIB_CHECK_VERSION(2,54,0)
gboolean
diff --git a/src/libqmi-glib/qmi-helpers.h b/src/libqmi-glib/qmi-helpers.h
index b954fb1e..26eef9c5 100644
--- a/src/libqmi-glib/qmi-helpers.h
+++ b/src/libqmi-glib/qmi-helpers.h
@@ -90,6 +90,12 @@ gboolean qmi_helpers_list_links (GFile *sysfs_file,
GPtrArray **out_links,
GError **error);
+G_GNUC_INTERNAL
+void qmi_helpers_clear_string (gchar **value);
+
+G_GNUC_INTERNAL
+void qmi_helpers_clear_array (GArray **value);
+
static inline gfloat
QMI_GFLOAT_SWAP_LE_BE (gfloat in)
{