style: use hash_xinsert

* gnulib: Update to get hash_xinsert.
Use it where appropriate.
This commit is contained in:
Akim Demaille
2020-05-17 12:00:02 +02:00
parent ac3b6c18a5
commit 4590071287
8 changed files with 22 additions and 34 deletions

View File

@@ -887,17 +887,16 @@ symbol_from_uniqstr (const uniqstr key, location loc)
symbol probe;
probe.tag = key;
symbol *entry = hash_lookup (symbol_table, &probe);
symbol *res = hash_lookup (symbol_table, &probe);
if (!entry)
if (!res)
{
/* First insertion in the hash. */
aver (!symbols_sorted);
entry = symbol_new (key, loc);
if (!hash_insert (symbol_table, entry))
xalloc_die ();
res = symbol_new (key, loc);
hash_xinsert (symbol_table, res);
}
return entry;
return res;
}
@@ -912,16 +911,15 @@ semantic_type_from_uniqstr (const uniqstr key, const location *loc)
semantic_type probe;
probe.tag = key;
semantic_type *entry = hash_lookup (semantic_type_table, &probe);
semantic_type *res = hash_lookup (semantic_type_table, &probe);
if (!entry)
if (!res)
{
/* First insertion in the hash. */
entry = semantic_type_new (key, loc);
if (!hash_insert (semantic_type_table, entry))
xalloc_die ();
res = semantic_type_new (key, loc);
hash_xinsert (semantic_type_table, res);
}
return entry;
return res;
}