pidref: introduce hash ops that doesn't come with destructor

This commit is contained in:
Mike Yuan
2023-11-11 17:21:10 +08:00
parent 2c302e8919
commit 4c8d5f0217
4 changed files with 11 additions and 11 deletions
+5 -6
View File
@@ -278,9 +278,8 @@ static int pidref_compare_func(const PidRef *a, const PidRef *b) {
return CMP(a->pid, b->pid);
}
DEFINE_HASH_OPS_WITH_KEY_DESTRUCTOR(
pidref_hash_ops,
PidRef,
pidref_hash_func,
pidref_compare_func,
pidref_free);
DEFINE_HASH_OPS(pidref_hash_ops, PidRef, pidref_hash_func, pidref_compare_func);
DEFINE_HASH_OPS_WITH_KEY_DESTRUCTOR(pidref_hash_ops_free,
PidRef, pidref_hash_func, pidref_compare_func,
pidref_free);
+2 -1
View File
@@ -61,4 +61,5 @@ int pidref_verify(const PidRef *pidref);
#define TAKE_PIDREF(p) TAKE_GENERIC((p), PidRef, PIDREF_NULL)
extern const struct hash_ops pidref_hash_ops; /* Has destructor call for pidref_free(), i.e. expects heap allocated PidRef as keys */
extern const struct hash_ops pidref_hash_ops;
extern const struct hash_ops pidref_hash_ops_free; /* Has destructor call for pidref_free(), i.e. expects heap allocated PidRef as keys */