summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2023-05-16 11:58:51 +0100
committerSimon McVittie <smcv@collabora.com>2023-05-17 11:35:44 +0100
commitb4038158f857b528d3924d96b0e8a7d3bddd1284 (patch)
treec59f9a960e4a16414f49ff658d6808ef88004e10
parenta0a3734f18707a4978d898bf4ab144ff2c35025a (diff)
downloadflatpak-b4038158f857b528d3924d96b0e8a7d3bddd1284.tar.gz
glib-backports: Make g_key_file_save_to_file match the GLib implementation
This just adds some assertions, no functional changes (assuming we're calling it correctly). Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r--common/flatpak-glib-backports-private.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/common/flatpak-glib-backports-private.h b/common/flatpak-glib-backports-private.h
index 1f42b9ac..3c44cfbe 100644
--- a/common/flatpak-glib-backports-private.h
+++ b/common/flatpak-glib-backports-private.h
@@ -43,7 +43,13 @@ g_key_file_save_to_file (GKeyFile *key_file,
gboolean success;
gsize length;
+ g_return_val_if_fail (key_file != NULL, FALSE);
+ g_return_val_if_fail (filename != NULL, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
contents = g_key_file_to_data (key_file, &length, NULL);
+ g_assert (contents != NULL);
+
success = g_file_set_contents (filename, contents, length, error);
g_free (contents);