[ostree] ot_keyfile_copy_group: return FALSE on invalid inputs
- From: Giuseppe Scrivano <gscrivano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] ot_keyfile_copy_group: return FALSE on invalid inputs
- Date: Fri, 6 Mar 2015 17:46:30 +0000 (UTC)
commit 021c55f430daf629ea2d9e0a0520e3564fc6255f
Author: Giuseppe Scrivano <gscrivan redhat com>
Date: Thu Mar 5 14:40:00 2015 +0100
ot_keyfile_copy_group: return FALSE on invalid inputs
The function returns a gboolean, replace g_return_if_fail with
g_return_val_if_fail.
Add similar checks to the other functions.
Signed-off-by: Giuseppe Scrivano <gscrivan redhat com>
src/libotutil/ot-keyfile-utils.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/libotutil/ot-keyfile-utils.c b/src/libotutil/ot-keyfile-utils.c
index 6a89357..c585108 100644
--- a/src/libotutil/ot-keyfile-utils.c
+++ b/src/libotutil/ot-keyfile-utils.c
@@ -38,6 +38,10 @@ ot_keyfile_get_boolean_with_default (GKeyFile *keyfile,
GError *temp_error = NULL;
gboolean ret_bool;
+ g_return_val_if_fail (keyfile != NULL, ret);
+ g_return_val_if_fail (section != NULL, ret);
+ g_return_val_if_fail (value != NULL, ret);
+
ret_bool = g_key_file_get_boolean (keyfile, section, value, &temp_error);
if (temp_error)
{
@@ -71,6 +75,10 @@ ot_keyfile_get_value_with_default (GKeyFile *keyfile,
GError *temp_error = NULL;
gs_free char *ret_value = NULL;
+ g_return_val_if_fail (keyfile != NULL, ret);
+ g_return_val_if_fail (section != NULL, ret);
+ g_return_val_if_fail (value != NULL, ret);
+
ret_value = g_key_file_get_value (keyfile, section, value, &temp_error);
if (temp_error)
{
@@ -101,9 +109,9 @@ ot_keyfile_copy_group (GKeyFile *source_keyfile,
gsize length, ii;
gboolean ret = FALSE;
- g_return_if_fail (source_keyfile != NULL);
- g_return_if_fail (target_keyfile != NULL);
- g_return_if_fail (group_name != NULL);
+ g_return_val_if_fail (source_keyfile != NULL, ret);
+ g_return_val_if_fail (target_keyfile != NULL, ret);
+ g_return_val_if_fail (group_name != NULL, ret);
keys = g_key_file_get_keys (source_keyfile, group_name, &length, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]