Improve qp-trie refcount debugging

Add some qp-trie tracing macros which can be enabled by a
developer. These print a message when a leaf is attached or
detached, indicating which part of the qp-trie implementation
did so. The refcount methods must now return the refcount value
so it can be printed by the trace macros.
This commit is contained in:
Tony Finch
2023-02-27 13:47:57 +00:00
parent 7dcde5d2fc
commit a8b29f0365
7 changed files with 57 additions and 20 deletions
+5 -4
View File
@@ -57,18 +57,19 @@ static struct {
dns_qpkey_t ascii;
} item[256 * 256 / 4];
static void
static uint32_t
fuzz_attach(void *ctx, void *pval, uint32_t ival) {
assert(ctx == NULL);
assert(pval == &item[ival]);
item[ival].refcount++;
return (item[ival].refcount++);
}
static void
static uint32_t
fuzz_detach(void *ctx, void *pval, uint32_t ival) {
assert(ctx == NULL);
assert(pval == &item[ival]);
item[ival].refcount--;
assert(item[ival].refcount > 0);
return (item[ival].refcount--);
}
static size_t