summaryrefslogtreecommitdiff
path: root/src/supplicant/nm-supplicant-interface.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-03-23 11:09:24 +0100
committerThomas Haller <thaller@redhat.com>2020-03-23 11:22:38 +0100
commit52dbab7d0703d9f3982fcddd855b92886eaef866 (patch)
treee0d01ed5a80a664f58e287d6252af4c277178170 /src/supplicant/nm-supplicant-interface.c
parent073994ca4284a5e99314195981aa254f06c3bf69 (diff)
all: use nm_clear_pointer() instead of g_clear_pointer()
g_clear_pointer() would always cast the destroy notify function pointer to GDestroyNotify. That means, it lost some type safety, like GPtrArray *ptr_arr = ... g_clear_pointer (&ptr_arr, g_array_unref); Since glib 2.58 ([1]), g_clear_pointer() is also more type safe. But this is not used by NetworkManager, because we don't set GLIB_VERSION_MIN_REQUIRED to 2.58. [1] https://gitlab.gnome.org/GNOME/glib/-/commit/f9a9902aac826ab4aecc25f6eb533a418a4fa559 We have nm_clear_pointer() to avoid this issue for a long time (pre 1.12.0). Possibly we should redefine in our source tree g_clear_pointer() as nm_clear_pointer(). However, I don't like to patch glib functions with our own variant. Arguably, we do patch g_clear_error() in such a manner. But there the point is to make the function inlinable. Also, nm_clear_pointer() returns a boolean that indicates whether anything was cleared. That is sometimes useful. I think we should just consistently use nm_clear_pointer() instead, which does always the preferable thing. Replace: sed 's/\<g_clear_pointer *(\([^;]*\), *\([a-z_A-Z0-9]\+\) *)/nm_clear_pointer (\1, \2)/g' $(git grep -l g_clear_pointer) -i
Diffstat (limited to 'src/supplicant/nm-supplicant-interface.c')
-rw-r--r--src/supplicant/nm-supplicant-interface.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/supplicant/nm-supplicant-interface.c b/src/supplicant/nm-supplicant-interface.c
index d91d1ca3b1..9725b983dd 100644
--- a/src/supplicant/nm-supplicant-interface.c
+++ b/src/supplicant/nm-supplicant-interface.c
@@ -3174,8 +3174,8 @@ dispose (GObject *object)
nm_assert (!priv->assoc_data);
- g_clear_pointer (&priv->bss_idx, g_hash_table_destroy);
- g_clear_pointer (&priv->peer_idx, g_hash_table_destroy);
+ nm_clear_pointer (&priv->bss_idx, g_hash_table_destroy);
+ nm_clear_pointer (&priv->peer_idx, g_hash_table_destroy);
nm_clear_pointer (&priv->current_bss, nm_ref_string_unref);