From 585ef0697811e7d62ab17142c8eed2f9372cd074 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Fri, 31 Aug 2012 23:02:19 +0200 Subject: Add tor_addr_port_new(). --- src/common/address.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/common/address.c') diff --git a/src/common/address.c b/src/common/address.c index e88869f1d8..e5862be1e9 100644 --- a/src/common/address.c +++ b/src/common/address.c @@ -1697,3 +1697,15 @@ tor_addr_hostname_is_local(const char *name) !strcasecmpend(name, ".local"); } + +/** Return a newly allocated tor_addr_port_t with addr and + port filled in. */ +tor_addr_port_t * +tor_addr_port_new(const tor_addr_t *addr, uint16_t port) +{ + tor_addr_port_t *ap = tor_malloc_zero(sizeof(tor_addr_port_t)); + if (addr) + tor_addr_copy(&ap->addr, addr); + ap->port = port; + return ap; +} -- cgit v1.2.3-54-g00ecf