[glib: 13/17] gkeyfile: Remove some redundant checks
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 13/17] gkeyfile: Remove some redundant checks
- Date: Tue, 2 Nov 2021 11:08:17 +0000 (UTC)
commit 655e2bac33104e66894e93d9aa6de7a81576ae6c
Author: Philip Withnall <pwithnall endlessos org>
Date: Sun Mar 14 16:57:33 2021 +0000
gkeyfile: Remove some redundant checks
`g_key_file_parse_key_value_pair()` checks that both of these are
non-NULL on entry, and they can’t be modified between then and here.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
glib/gkeyfile.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/glib/gkeyfile.c b/glib/gkeyfile.c
index 0f8d18e44..17494d4a9 100644
--- a/glib/gkeyfile.c
+++ b/glib/gkeyfile.c
@@ -1406,9 +1406,11 @@ g_key_file_parse_key_value_pair (GKeyFile *key_file,
g_warn_if_fail (key_file->start_group != NULL);
- if (key_file->current_group
- && key_file->current_group->name
- && key_file->start_group == key_file->current_group
+ /* Checked on entry to this function */
+ g_assert (key_file->current_group != NULL);
+ g_assert (key_file->current_group->name != NULL);
+
+ if (key_file->start_group == key_file->current_group
&& strcmp (key, "Encoding") == 0)
{
if (value_len != strlen ("UTF-8") ||
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]