[glib: 9/17] gkeyfile: Tidy up ownership transfer in parse_key_value_pair()
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 9/17] gkeyfile: Tidy up ownership transfer in parse_key_value_pair()
- Date: Tue, 2 Nov 2021 11:08:16 +0000 (UTC)
commit 6c70d30f073fda0bb8eeeba947504baa4fb6ce74
Author: Philip Withnall <pwithnall endlessos org>
Date: Sun Mar 14 14:10:19 2021 +0000
gkeyfile: Tidy up ownership transfer in parse_key_value_pair()
This introduces no functional changes, but does make the ownership
transfer a little clearer.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
glib/gkeyfile.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/glib/gkeyfile.c b/glib/gkeyfile.c
index 2e49b21f3..50ed5305d 100644
--- a/glib/gkeyfile.c
+++ b/glib/gkeyfile.c
@@ -1431,17 +1431,14 @@ g_key_file_parse_key_value_pair (GKeyFile *key_file,
GKeyFileKeyValuePair *pair;
pair = g_slice_new (GKeyFileKeyValuePair);
- pair->key = key;
- pair->value = value;
+ pair->key = g_steal_pointer (&key);
+ pair->value = g_steal_pointer (&value);
g_key_file_add_key_value_pair (key_file, key_file->current_group, pair);
}
- else
- {
- g_free (key);
- g_free (value);
- }
+ g_free (key);
+ g_free (value);
g_free (locale);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]