diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2011-11-16 15:59:04 +0100 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2011-11-16 15:59:04 +0100 |
commit | 9ec9fd41456f199d95d05a0d29f040a169039d24 (patch) | |
tree | ff83ef1c93fc2b9c346859c4ae627540b087a84d /src | |
parent | 3785f4686c084558b0b693c7d625088efe432d73 (diff) |
Use _unref instead of _free _destroy when possible.unref
Replace g_(ptr_)array_free (foo, TRUE) and g_hash_table_destroy
with respectively g_(ptr_)array_unref (foo) and g_hash_table_unref.
I used this command to generate this patch:
for f in `find -name "*.c"`; do sed -i $f -re 's/g_ptr_array_free \(([^ ,]+), TRUE\)/g_ptr_array_unref \(\1\)/'; done
See Danielle's blog for explanation of possible bug _free can do:
http://blogs.gnome.org/danni/2011/11/16/mistakes-with-g_value_set_boxed/
Diffstat (limited to 'src')
-rw-r--r-- | src/sip-connection-helpers.c | 6 | ||||
-rw-r--r-- | src/write-mgr-file.c | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/sip-connection-helpers.c b/src/sip-connection-helpers.c index 6408d3e..6152f5d 100644 --- a/src/sip-connection-helpers.c +++ b/src/sip-connection-helpers.c @@ -384,7 +384,7 @@ rakia_conn_update_nua_outbound (RakiaConnection *conn) priv_nua_set_outbound_options (priv->sofia_nua, option_table); - g_hash_table_destroy (option_table); + g_hash_table_unref (option_table); } static void @@ -492,7 +492,7 @@ priv_stun_resolver_cb (sres_context_t *ctx, sres_query_t *query, sres_record_t * ans = g_ptr_array_index (items, g_random_int_range (0, items->len)); } - g_ptr_array_free (items, TRUE); + g_ptr_array_unref (items); } if (NULL != ans) @@ -626,7 +626,7 @@ priv_stun_discover_cb (sres_context_t *ctx, } } - g_array_free (items, TRUE); + g_array_unref (items); } if (sel != NULL) diff --git a/src/write-mgr-file.c b/src/write-mgr-file.c index a503c4f..c1bddd5 100644 --- a/src/write-mgr-file.c +++ b/src/write-mgr-file.c @@ -316,7 +316,7 @@ mgr_file_contents (const char *busname, WRITE_STR (TP_PROP_PROTOCOL_ICON, "Icon"); g_free (section_name); - g_hash_table_destroy (props); + g_hash_table_unref (props); protocols = protocols->next; } |