summaryrefslogtreecommitdiff
path: root/glib/gkeyfile.c
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2023-01-24 19:07:46 +0300
committerSergey Bugaev <bugaevc@gmail.com>2023-01-27 11:55:27 +0300
commitbccff754b65628bd08e124566eb0ea4aa6603a08 (patch)
tree1b2574897f55716c494436478726d87b00c5176f /glib/gkeyfile.c
parent5e40004bdb06d33aeb4d6fd1f03a8493718c45a9 (diff)
downloadglib-bccff754b65628bd08e124566eb0ea4aa6603a08.tar.gz
Use g_string_free_and_steal () more
Now that there is g_string_free_and_steal (), we can use it instead of the older g_string_free (_, FALSE). Make sure to use its return value while doing so, as opposed to manually accessing string->str, to avoid compiler warnings and make the intent more explicit. This is all done in preparation for making g_string_free (_, FALSE) warn on unused return value much like g_string_free_and_steal (), which will happen in the next commit. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Diffstat (limited to 'glib/gkeyfile.c')
-rw-r--r--glib/gkeyfile.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/glib/gkeyfile.c b/glib/gkeyfile.c
index 6ae738ca1..fb65d55c5 100644
--- a/glib/gkeyfile.c
+++ b/glib/gkeyfile.c
@@ -3546,10 +3546,7 @@ g_key_file_get_key_comment (GKeyFile *key_file,
}
if (string != NULL)
- {
- comment = string->str;
- g_string_free (string, FALSE);
- }
+ comment = g_string_free_and_steal (g_steal_pointer (&string));
else
comment = NULL;