diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-11-17 12:27:25 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-12-08 14:47:19 -0500 |
commit | c92ac9f5cbb4440b5f87c7e0dd6bec5147d72405 (patch) | |
tree | 2cd04944fc6132f5abadddbe6d225801385abcac /src/common/di_ops.h | |
parent | 2f086888b14be3998421b29bfc81d037b8073202 (diff) | |
download | tor-c92ac9f5cbb4440b5f87c7e0dd6bec5147d72405.tar.gz tor-c92ac9f5cbb4440b5f87c7e0dd6bec5147d72405.zip |
Convert the rest of src/common's headers to use FREE_AND_NULL
Diffstat (limited to 'src/common/di_ops.h')
-rw-r--r-- | src/common/di_ops.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/common/di_ops.h b/src/common/di_ops.h index e79973ba52..67d9c9f0df 100644 --- a/src/common/di_ops.h +++ b/src/common/di_ops.h @@ -37,7 +37,12 @@ int safe_mem_is_zero(const void *mem, size_t sz); typedef struct di_digest256_map_t di_digest256_map_t; typedef void (*dimap_free_fn)(void *); -void dimap_free(di_digest256_map_t *map, dimap_free_fn free_fn); +void dimap_free_(di_digest256_map_t *map, dimap_free_fn free_fn); +#define dimap_free(map, free_fn) \ + do { \ + dimap_free_((map), (free_fn)); \ + (map) = NULL; \ + } while (0) void dimap_add_entry(di_digest256_map_t **map, const uint8_t *key, void *val); void *dimap_search(const di_digest256_map_t *map, const uint8_t *key, |