* lib/hash.h, lib/xhash.c (hash_xinsert): New.
+2020-05-17 Akim Demaille <akim@lrde.epita.fr>
+
+ hash: add hash_xinsert
+ * lib/hash.h, lib/xhash.c (hash_xinsert): New.
+
2020-05-16 Bruno Haible <bruno@clisp.org>
findprog-lgpl: Fix link error (existing since 2008-09-02).
/* Insertion and deletion. */
bool hash_rehash (Hash_table *, size_t) _GL_ATTRIBUTE_NODISCARD;
void *hash_insert (Hash_table *, const void *) _GL_ATTRIBUTE_NODISCARD;
+void *hash_xinsert (Hash_table *, const void *);
int hash_insert_if_absent (Hash_table *table, const void *entry,
const void **matched_ent);
xalloc_die ();
return res;
}
+
+/* Same as hash_insert, but invokes xalloc_die on memory
+ exhaustion. */
+
+void *
+hash_xinsert (Hash_table *table, void const *entry)
+{
+ void *res = hash_insert (table, entry);
+ if (!res)
+ xalloc_die ();
+ return res;
+}