summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-08-02 13:33:41 -0400
committerNick Mathewson <nickm@torproject.org>2016-08-02 13:33:41 -0400
commitcd9d39d54bbc9998938e9acddb1ec34507fc9108 (patch)
treea6ef33cab53e6c79fd6133e361e44e1e5f1df421 /src
parent88a7a027286046b1f9af3d495c1081a7f503efc5 (diff)
downloadtor-cd9d39d54bbc9998938e9acddb1ec34507fc9108.tar.gz
tor-cd9d39d54bbc9998938e9acddb1ec34507fc9108.zip
Rename generic_buffer_set_to_copy, since generic buffers are not a thing
Diffstat (limited to 'src')
-rw-r--r--src/or/buffers.c4
-rw-r--r--src/or/buffers.h5
-rw-r--r--src/or/connection_edge.c4
-rw-r--r--src/test/test_buffers.c8
4 files changed, 11 insertions, 10 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c
index ecaafbba56..0afa3e6363 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -1978,8 +1978,8 @@ write_to_buf_zlib(buf_t *buf, tor_zlib_state_t *state,
/** Set *<b>output</b> to contain a copy of the data in *<b>input</b> */
int
-generic_buffer_set_to_copy(generic_buffer_t **output,
- const generic_buffer_t *input)
+buf_set_to_copy(generic_buffer_t **output,
+ const generic_buffer_t *input)
{
if (*output)
buf_free(*output);
diff --git a/src/or/buffers.h b/src/or/buffers.h
index 2b25bc3c07..3629fc32c5 100644
--- a/src/or/buffers.h
+++ b/src/or/buffers.h
@@ -64,8 +64,9 @@ int fetch_ext_or_command_from_buf(buf_t *buf, ext_or_cmd_t **out);
#define generic_buffer_free(b) buf_free((b))
#define generic_buffer_fetch_ext_or_cmd(b, out) \
fetch_ext_or_command_from_buf((b), (out))
-int generic_buffer_set_to_copy(generic_buffer_t **output,
- const generic_buffer_t *input);
+
+int buf_set_to_copy(generic_buffer_t **output,
+ const generic_buffer_t *input);
void assert_buf_ok(buf_t *buf);
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index d5eada61d8..4fb195f17d 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -1025,8 +1025,8 @@ connection_ap_detach_retriable(entry_connection_t *conn,
pathbias_mark_use_rollback(circ);
if (conn->pending_optimistic_data) {
- generic_buffer_set_to_copy(&conn->sending_optimistic_data,
- conn->pending_optimistic_data);
+ buf_set_to_copy(&conn->sending_optimistic_data,
+ conn->pending_optimistic_data);
}
if (!get_options()->LeaveStreamsUnattached || conn->use_begindir) {
diff --git a/src/test/test_buffers.c b/src/test/test_buffers.c
index 95584d54a8..a8a2d95f2b 100644
--- a/src/test/test_buffers.c
+++ b/src/test/test_buffers.c
@@ -314,7 +314,7 @@ test_buffer_copy(void *arg)
tt_assert(buf);
/* Copy an empty buffer. */
- tt_int_op(0, OP_EQ, generic_buffer_set_to_copy(&buf2, buf));
+ tt_int_op(0, OP_EQ, buf_set_to_copy(&buf2, buf));
tt_assert(buf2);
tt_int_op(0, OP_EQ, generic_buffer_len(buf2));
@@ -325,14 +325,14 @@ test_buffer_copy(void *arg)
tt_int_op(len, OP_EQ, generic_buffer_len(buf));
/* Add junk to buf2 so we can test replacing.*/
generic_buffer_add(buf2, "BLARG", 5);
- tt_int_op(0, OP_EQ, generic_buffer_set_to_copy(&buf2, buf));
+ tt_int_op(0, OP_EQ, buf_set_to_copy(&buf2, buf));
tt_int_op(len, OP_EQ, generic_buffer_len(buf2));
generic_buffer_get(buf2, b, len);
tt_mem_op(b, OP_EQ, s, len);
/* Now free buf2 and retry so we can test allocating */
generic_buffer_free(buf2);
buf2 = NULL;
- tt_int_op(0, OP_EQ, generic_buffer_set_to_copy(&buf2, buf));
+ tt_int_op(0, OP_EQ, buf_set_to_copy(&buf2, buf));
tt_int_op(len, OP_EQ, generic_buffer_len(buf2));
generic_buffer_get(buf2, b, len);
tt_mem_op(b, OP_EQ, s, len);
@@ -350,7 +350,7 @@ test_buffer_copy(void *arg)
generic_buffer_add(buf, b, 1);
generic_buffer_add(buf, s, len);
}
- tt_int_op(0, OP_EQ, generic_buffer_set_to_copy(&buf2, buf));
+ tt_int_op(0, OP_EQ, buf_set_to_copy(&buf2, buf));
tt_int_op(generic_buffer_len(buf2), OP_EQ, generic_buffer_len(buf));
for (i = 0; i < 256; ++i) {
generic_buffer_get(buf2, b, len+1);