Commit c58f7aa4 authored by Carlos Garnacho's avatar Carlos Garnacho

libtracker-sparql: Avoid implicitly relying on hashtable iteration order

Recent GLib changed the hashtable hashing, thus changing the order in which
the contents are iterated by a GHashTableIter. Avoid doing that in the one
place we used to (also used to happen in previous vala code).
parent 15784105
......@@ -2910,9 +2910,13 @@ translate_InsertClause (TrackerSparql *sparql,
* Clause may start with:
* 'INSERT' ('OR' 'REPLACE')? ('SILENT')? ('INTO' iri)?
*/
sparql->current_state.blank_node_map =
g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, g_free);
if (sparql->blank_nodes) {
g_variant_builder_open (sparql->blank_nodes, G_VARIANT_TYPE ("a{ss}"));
sparql->current_state.blank_node_map =
g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, g_free);
}
old_graph = sparql->current_state.graph;
sparql->current_state.type = TRACKER_SPARQL_TYPE_INSERT;
......@@ -2939,15 +2943,6 @@ translate_InsertClause (TrackerSparql *sparql,
sparql->current_state.graph = old_graph;
if (sparql->blank_nodes) {
GHashTableIter iter;
gpointer key, value;
g_hash_table_iter_init (&iter, sparql->current_state.blank_node_map);
g_variant_builder_open (sparql->blank_nodes, G_VARIANT_TYPE ("a{ss}"));
while (g_hash_table_iter_next (&iter, &key, &value))
g_variant_builder_add (sparql->blank_nodes, "{ss}", key, value);
g_variant_builder_close (sparql->blank_nodes);
}
......@@ -6174,6 +6169,7 @@ translate_BlankNode (TrackerSparql *sparql,
bnode_id = tracker_data_query_unused_uuid (sparql->data_manager, iface);
g_hash_table_insert (sparql->current_state.blank_node_map,
g_strdup (str), bnode_id);
g_variant_builder_add (sparql->blank_nodes, "{ss}", str, bnode_id);
}
tracker_token_literal_init (sparql->current_state.token, bnode_id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment