aboutsummaryrefslogtreecommitdiff
path: root/src/common/address.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@torproject.org>2012-08-31 23:02:19 +0200
committerNick Mathewson <nickm@torproject.org>2012-09-04 12:03:42 -0400
commit585ef0697811e7d62ab17142c8eed2f9372cd074 (patch)
tree7440ac60a7cf721561c4387951ee18b71f1a1239 /src/common/address.c
parent68901da5a1dcfb210f7e8210af0b63c6161f9b63 (diff)
downloadtor-585ef0697811e7d62ab17142c8eed2f9372cd074.tar
tor-585ef0697811e7d62ab17142c8eed2f9372cd074.tar.gz
Add tor_addr_port_new().
Diffstat (limited to 'src/common/address.c')
-rw-r--r--src/common/address.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common/address.c b/src/common/address.c
index e88869f1d..e5862be1e 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 <b>addr</b> and
+ <b>port</b> 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;
+}