]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/journal/catalog.c
Merge pull request #10920 from yuwata/hashmap-destructor
[thirdparty/systemd.git] / src / journal / catalog.c
index e4ca959bd643bb7267d516cd8f5b5f098b4da1d5..3556a101bf262a3ea29113c57fd4499a86e2c3b4 100644 (file)
@@ -50,9 +50,7 @@ typedef struct CatalogItem {
         le64_t offset;
 } CatalogItem;
 
-static void catalog_hash_func(const void *p, struct siphash *state) {
-        const CatalogItem *i = p;
-
+static void catalog_hash_func(const CatalogItem *i, struct siphash *state) {
         siphash24_compress(&i->id, sizeof(i->id), state);
         siphash24_compress(i->language, strlen(i->language), state);
 }
@@ -70,10 +68,7 @@ static int catalog_compare_func(const CatalogItem *a, const CatalogItem *b) {
         return strcmp(a->language, b->language);
 }
 
-const struct hash_ops catalog_hash_ops = {
-        .hash = catalog_hash_func,
-        .compare = (comparison_fn_t) catalog_compare_func,
-};
+DEFINE_HASH_OPS(catalog_hash_ops, CatalogItem, catalog_hash_func, catalog_compare_func);
 
 static bool next_header(const char **s) {
         const char *e;