Skip to content

Commit

Permalink
Call uthash HASH_VALUE() instead of HASH_FUNCTION()
Browse files Browse the repository at this point in the history
HASH_FUNCTION() is an extension point, not part of the public API.  Use
HASH_VALUE() instead.  The former happens to work with uthash >= 2.3.0,
but not with older versions.

Fixes build with uthash-static from RHEL 8.
  • Loading branch information
bgilbert committed Mar 28, 2024
1 parent 60f291d commit 72f3e1a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/dicom-dict-build.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static void make_table(const char *name, const void *items, int count,
}
int this_key_len = key_len ? key_len : (int) strlen(KEY(i));
unsigned hash;
HASH_FUNCTION(KEY(i), this_key_len, hash);
HASH_VALUE(KEY(i), this_key_len, hash);
int cell, probe;
for (probe = 0, cell = hash % table_len;
probe < MAX_PROBES && table[cell] != EMPTY;
Expand Down
2 changes: 1 addition & 1 deletion src/dicom-dict.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#define LOOKUP(table, field, hash, key, key_len, out) do { \
unsigned hash_value; \
HASH_FUNCTION(key, key_len, hash_value); \
HASH_VALUE(key, key_len, hash_value); \
for (int probe = 0; true; probe++) { \
int i = hash ## _dict[(hash_value + probe) % hash ## _len]; \
if (i == hash ## _empty || probe == LOOKUP_MAX_PROBES) { \
Expand Down

0 comments on commit 72f3e1a

Please sign in to comment.