summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-05-07 23:06:57 +0200
committerThomas Haller <thaller@redhat.com>2021-05-14 11:41:32 +0200
commitb5c5b2443d2e725e6c23c5931723ba888ee7586e (patch)
treea1eaf2ed690c6920428463349279d7b3eccc3f5c
parent9a95146b70c1be1607619650e357349eadfb9759 (diff)
downloadNetworkManager-b5c5b2443d2e725e6c23c5931723ba888ee7586e.tar.gz
glib-aux: add nm_g_error_free() helper
-rw-r--r--src/libnm-glib-aux/nm-macros-internal.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libnm-glib-aux/nm-macros-internal.h b/src/libnm-glib-aux/nm-macros-internal.h
index a6910b2d3b..edaa6f3902 100644
--- a/src/libnm-glib-aux/nm-macros-internal.h
+++ b/src/libnm-glib-aux/nm-macros-internal.h
@@ -1082,6 +1082,13 @@ nm_clear_error(GError **err)
}
}
+static inline void
+nm_g_error_free(GError *err)
+{
+ if (err)
+ g_error_free(err);
+}
+
/* Patch g_clear_error() to use nm_clear_error(), which is inlineable
* and visible to the compiler. For example gs_free_error attribute only
* frees the error after checking that it's not %NULL. So, in many cases