commit d11b772a6c621d7011eed20cd58383c6f1ac0b54 Author: George Kadianakis desnacked@riseup.net Date: Wed Jan 25 21:23:46 2012 +0200
Introduce a transport_t deep copy function. --- src/or/transports.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/or/transports.c b/src/or/transports.c index 4f67a46..566cd93 100644 --- a/src/or/transports.c +++ b/src/or/transports.c @@ -195,6 +195,25 @@ transport_free(transport_t *transport) tor_free(transport); }
+/** Return a deep copy of <b>transport</b>. */ +static transport_t * +transport_copy(const transport_t *transport) +{ + transport_t *new_transport = NULL; + + tor_assert(transport); + + new_transport = tor_malloc_zero(sizeof(transport_t)); + + new_transport->socks_version = transport->socks_version; + new_transport->name = tor_strdup(transport->name); + tor_addr_copy(&new_transport->addr, &transport->addr); + new_transport->port = transport->port; + new_transport->marked_for_removal = transport->marked_for_removal; + + return new_transport; +} + /** Returns the transport in our transport list that has the name <b>name</b>. * Else returns NULL. */ transport_t *
tor-commits@lists.torproject.org