aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_extorport.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-08-08 15:54:15 -0400
committerNick Mathewson <nickm@torproject.org>2017-09-05 13:57:51 -0400
commit6ec50597231c8d72fbf796eee88e02dd9a4d0b78 (patch)
tree24001fe0eb99beb6cbaa0c2768f1df1fd4595949 /src/test/test_extorport.c
parentd61da9e61fa0ea15789464c7c3754a9af30fcbb4 (diff)
downloadtor-6ec50597231c8d72fbf796eee88e02dd9a4d0b78.tar.gz
tor-6ec50597231c8d72fbf796eee88e02dd9a4d0b78.zip
Refactor buffer APIs to put a buf_t first.
By convention, a function that frobs a foo_t should be called foo_frob, and it should have a foo_t * as its first argument. But for many of the buf_t functions, the buf_t was the final argument, which is silly.
Diffstat (limited to 'src/test/test_extorport.c')
-rw-r--r--src/test/test_extorport.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/test_extorport.c b/src/test/test_extorport.c
index f8ee94c3ac..9e8721ee36 100644
--- a/src/test/test_extorport.c
+++ b/src/test/test_extorport.c
@@ -78,7 +78,7 @@ connection_write_to_buf_impl_replacement(const char *string, size_t len,
tor_assert(string);
tor_assert(conn);
- buf_add(string, len, conn->outbuf);
+ buf_add(conn->outbuf, string, len);
}
static char *
@@ -89,7 +89,7 @@ buf_get_contents(buf_t *buf, size_t *sz_out)
if (*sz_out >= ULONG_MAX)
return NULL; /* C'mon, really? */
out = tor_malloc(*sz_out + 1);
- if (buf_get_bytes(out, (unsigned long)*sz_out, buf) != 0) {
+ if (buf_get_bytes(buf, out, (unsigned long)*sz_out) != 0) {
tor_free(out);
return NULL;
}
@@ -399,14 +399,14 @@ handshake_start(or_connection_t *conn, int receiving)
#define WRITE(s,n) \
do { \
- buf_add((s), (n), TO_CONN(conn)->inbuf); \
+ buf_add(TO_CONN(conn)->inbuf, (s), (n)); \
} while (0)
#define CONTAINS(s,n) \
do { \
tt_int_op((n), OP_LE, sizeof(b)); \
tt_int_op(buf_datalen(TO_CONN(conn)->outbuf), OP_EQ, (n)); \
if ((n)) { \
- buf_get_bytes(b, (n), TO_CONN(conn)->outbuf); \
+ buf_get_bytes(TO_CONN(conn)->outbuf, b, (n)); \
tt_mem_op(b, OP_EQ, (s), (n)); \
} \
} while (0)