[gnome-software: 2/3] gs-odrs-provider: Remove a redundant hash table lookup
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 2/3] gs-odrs-provider: Remove a redundant hash table lookup
- Date: Fri, 18 Mar 2022 10:02:59 +0000 (UTC)
commit 0338437c2070d1269932be1ee7c10a6a53db89a0
Author: Philip Withnall <pwithnall endlessos org>
Date: Fri Mar 11 14:49:51 2022 +0000
gs-odrs-provider: Remove a redundant hash table lookup
The return value from `g_hash_table_add()` does what we want.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
lib/gs-odrs-provider.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/lib/gs-odrs-provider.c b/lib/gs-odrs-provider.c
index b58477bf8..8d431dda7 100644
--- a/lib/gs-odrs-provider.c
+++ b/lib/gs-odrs-provider.c
@@ -658,10 +658,8 @@ gs_odrs_provider_get_compat_ids (GsApp *app)
if (value == NULL)
continue;
- if (g_hash_table_lookup (ids, value) != NULL)
- continue;
- g_hash_table_add (ids, (gpointer) value);
- json_array_add_string_element (json_array, value);
+ if (g_hash_table_add (ids, (gpointer) value))
+ json_array_add_string_element (json_array, value);
}
}
if (json_array_get_length (json_array) == 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]