summaryrefslogtreecommitdiff
path: root/src/or/addressmap.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-12-08 10:21:12 -0500
committerNick Mathewson <nickm@torproject.org>2017-12-08 14:47:19 -0500
commitfa0d24286b1dac3959c338f6b76fc15dbe1559e5 (patch)
tree5ec27cfa8b633cc6729bbb7da9eface2541ccb28 /src/or/addressmap.c
parent17dcce3fe11bfea9c7c46d2b9fd5baeb63ebe1e2 (diff)
downloadtor-fa0d24286b1dac3959c338f6b76fc15dbe1559e5.tar.gz
tor-fa0d24286b1dac3959c338f6b76fc15dbe1559e5.zip
Convert remaining function (mostly static) to new free style
Diffstat (limited to 'src/or/addressmap.c')
-rw-r--r--src/or/addressmap.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/src/or/addressmap.c b/src/or/addressmap.c
index 9a2cc26b3b..96ce275578 100644
--- a/src/or/addressmap.c
+++ b/src/or/addressmap.c
@@ -90,34 +90,47 @@ addressmap_init(void)
virtaddress_reversemap = strmap_new();
}
+#define addressmap_ent_free(ent) \
+ FREE_AND_NULL(addressmap_entry_t, addressmap_ent_free_, (ent))
+
/** Free the memory associated with the addressmap entry <b>_ent</b>. */
static void
-addressmap_ent_free(void *_ent)
+addressmap_ent_free_(addressmap_entry_t *ent)
{
- addressmap_entry_t *ent;
- if (!_ent)
+ if (!ent)
return;
- ent = _ent;
tor_free(ent->new_address);
tor_free(ent);
}
+static void
+addressmap_ent_free_void(void *ent)
+{
+ addressmap_ent_free_(ent);
+}
+
+#define addressmap_virtaddress_ent_free(ent) \
+ FREE_AND_NULL(virtaddress_entry_t, addressmap_virtaddress_ent_free_, (ent))
+
/** Free storage held by a virtaddress_entry_t* entry in <b>_ent</b>. */
static void
-addressmap_virtaddress_ent_free(void *_ent)
+addressmap_virtaddress_ent_free_(virtaddress_entry_t *ent)
{
- virtaddress_entry_t *ent;
- if (!_ent)
+ if (!ent)
return;
-
- ent = _ent;
tor_free(ent->ipv4_address);
tor_free(ent->ipv6_address);
tor_free(ent->hostname_address);
tor_free(ent);
}
+static void
+addressmap_virtaddress_ent_free_void(void *ent)
+{
+ addressmap_virtaddress_ent_free_(ent);
+}
+
/** Remove <b>address</b> (which must map to <b>ent</b>) from the
* virtual address map. */
static void
@@ -311,10 +324,10 @@ addressmap_clean(time_t now)
void
addressmap_free_all(void)
{
- strmap_free(addressmap, addressmap_ent_free);
+ strmap_free(addressmap, addressmap_ent_free_void);
addressmap = NULL;
- strmap_free(virtaddress_reversemap, addressmap_virtaddress_ent_free);
+ strmap_free(virtaddress_reversemap, addressmap_virtaddress_ent_free_void);
virtaddress_reversemap = NULL;
}