mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 06:48:05 +01:00
Add a quick macro to calculate hashtable memory usage
This commit is contained in:
parent
9f69b3d94c
commit
793e97bb2a
1 changed files with 4 additions and 0 deletions
|
@ -42,6 +42,10 @@
|
|||
#define HT_SIZE(head) \
|
||||
((head)->hth_n_entries)
|
||||
|
||||
/* Return memory usage for a hashtable (not counting the entries themselves) */
|
||||
#define HT_MEM_USAGE(head) \
|
||||
(sizeof(*head) + (head)->hth_table_length * sizeof(void*))
|
||||
|
||||
#define HT_FIND(name, head, elm) name##_HT_FIND((head), (elm))
|
||||
#define HT_INSERT(name, head, elm) name##_HT_INSERT((head), (elm))
|
||||
#define HT_REPLACE(name, head, elm) name##_HT_REPLACE((head), (elm))
|
||||
|
|
Loading…
Add table
Reference in a new issue