chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
hashmap: hashmap_move_one() should return -ENOENT when 'other' is NULL
[elogind.git]
/
src
/
journal
/
catalog.c
diff --git
a/src/journal/catalog.c
b/src/journal/catalog.c
index f03357dedf9bc87ca84a28873d7e330282eae981..41d450b1544d6fbf2e8e140e016b2b42c2625cc2 100644
(file)
--- a/
src/journal/catalog.c
+++ b/
src/journal/catalog.c
@@
-64,7
+64,7
@@
typedef struct CatalogItem {
le64_t offset;
} CatalogItem;
le64_t offset;
} CatalogItem;
-unsigned long catalog_hash_func(const void *p, const uint8_t hash_key[HASH_KEY_SIZE]) {
+
static
unsigned long catalog_hash_func(const void *p, const uint8_t hash_key[HASH_KEY_SIZE]) {
const CatalogItem *i = p;
uint64_t u;
size_t l, sz;
const CatalogItem *i = p;
uint64_t u;
size_t l, sz;
@@
-81,7
+81,7
@@
unsigned long catalog_hash_func(const void *p, const uint8_t hash_key[HASH_KEY_S
return (unsigned long) u;
}
return (unsigned long) u;
}
-int catalog_compare_func(const void *a, const void *b) {
+
static
int catalog_compare_func(const void *a, const void *b) {
const CatalogItem *i = a, *j = b;
unsigned k;
const CatalogItem *i = a, *j = b;
unsigned k;
@@
-95,6
+95,11
@@
int catalog_compare_func(const void *a, const void *b) {
return strcmp(i->language, j->language);
}
return strcmp(i->language, j->language);
}
+const struct hash_ops catalog_hash_ops = {
+ .hash = catalog_hash_func,
+ .compare = catalog_compare_func
+};
+
static int finish_item(
Hashmap *h,
struct strbuf *sb,
static int finish_item(
Hashmap *h,
struct strbuf *sb,
@@
-407,7
+412,7
@@
int catalog_update(const char* database, const char* root, const char* const* di
unsigned n;
long r;
unsigned n;
long r;
- h = hashmap_new(
catalog_hash_func, catalog_compare_func
);
+ h = hashmap_new(
&catalog_hash_ops
);
sb = strbuf_new();
if (!h || !sb) {
sb = strbuf_new();
if (!h || !sb) {