forked from osmocom/wireshark
Use g_hash_table_replace() when key depends on data
Using g_hash_table_insert() in cases where the key is contained within value is error prone. Use g_hash_table_replace() to eliminate the risk of ending up with incoherent hash table state. Change-Id: I595457476a2682e927d2c56b2692404aef4dc43a Reviewed-on: https://code.wireshark.org/review/34385 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
05b6a9ad0b
commit
5f5a934bca
|
@ -521,7 +521,7 @@ new_stat_node(stats_tree *st, const gchar *name, int parent_id, stat_node_dataty
|
|||
}
|
||||
|
||||
if(node->parent->hash) {
|
||||
g_hash_table_insert(node->parent->hash,node->name,node);
|
||||
g_hash_table_replace(node->parent->hash,node->name,node);
|
||||
}
|
||||
|
||||
if (st->cfg->setup_node_pr) {
|
||||
|
|
|
@ -203,7 +203,7 @@ DIAG_ON_PEDANTIC
|
|||
new_plug->type_name = type_to_name(type);
|
||||
|
||||
/* Add it to the list of plugins. */
|
||||
g_hash_table_insert(plugins_module, new_plug->name, new_plug);
|
||||
g_hash_table_replace(plugins_module, new_plug->name, new_plug);
|
||||
}
|
||||
ws_dir_close(dir);
|
||||
g_free(plugin_folder);
|
||||
|
|
Loading…
Reference in New Issue