xhash.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* hash - hashing table processing.
  2. Copyright (C) 2019-2020 Free Software Foundation, Inc.
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <https://www.gnu.org/licenses/>. */
  13. #include <config.h>
  14. /* Specification. */
  15. #include "hash.h"
  16. #include "xalloc.h"
  17. Hash_table *
  18. hash_xinitialize (size_t candidate, const Hash_tuning *tuning,
  19. Hash_hasher hasher, Hash_comparator comparator,
  20. Hash_data_freer data_freer)
  21. {
  22. Hash_table *res =
  23. hash_initialize (candidate, tuning, hasher, comparator, data_freer);
  24. if (!res)
  25. xalloc_die ();
  26. return res;
  27. }
  28. void *
  29. hash_xinsert (Hash_table *table, void const *entry)
  30. {
  31. void *res = hash_insert (table, entry);
  32. if (!res)
  33. xalloc_die ();
  34. return res;
  35. }