[gnome-software: 1/3] gs-odrs-provider: Remove redundant g_strdup() call




commit 1605427d21e9766564a9a92374a4cc00b4524667
Author: Philip Withnall <pwithnall endlessos org>
Date:   Fri Mar 11 14:48:28 2022 +0000

    gs-odrs-provider: Remove redundant g_strdup() call
    
    The `AsProvided` instances are alive for the entire duration of the
    `gs_odrs_provider_get_compat_ids()` call, which is longer than the
    lifetime of the hash table.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 lib/gs-odrs-provider.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/lib/gs-odrs-provider.c b/lib/gs-odrs-provider.c
index b8c647e9f..b58477bf8 100644
--- a/lib/gs-odrs-provider.c
+++ b/lib/gs-odrs-provider.c
@@ -644,7 +644,7 @@ gs_odrs_provider_get_compat_ids (GsApp *app)
        g_autoptr(JsonArray) json_array = json_array_new ();
        g_autoptr(JsonNode) json_node = json_node_new (JSON_NODE_ARRAY);
 
-       ids = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+       ids = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL);
        for (guint i = 0; i < provided->len; i++) {
                GPtrArray *items;
                AsProvided *prov = g_ptr_array_index (provided, i);
@@ -660,7 +660,7 @@ gs_odrs_provider_get_compat_ids (GsApp *app)
 
                        if (g_hash_table_lookup (ids, value) != NULL)
                                continue;
-                       g_hash_table_add (ids, g_strdup (value));
+                       g_hash_table_add (ids, (gpointer) value);
                        json_array_add_string_element (json_array, value);
                }
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]