[tor-commits] [tor/master] Rename generic_buffer_set_to_copy, since generic buffers are not a thing

nickm at torproject.org nickm at torproject.org
Fri Aug 12 20:11:39 UTC 2016


commit cd9d39d54bbc9998938e9acddb1ec34507fc9108
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Aug 2 13:33:41 2016 -0400

    Rename generic_buffer_set_to_copy, since generic buffers are not a thing
---
 src/or/buffers.c         | 4 ++--
 src/or/buffers.h         | 5 +++--
 src/or/connection_edge.c | 4 ++--
 src/test/test_buffers.c  | 8 ++++----
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/or/buffers.c b/src/or/buffers.c
index ecaafbb..0afa3e6 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 2b25bc3..3629fc3 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 d5eada6..4fb195f 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 95584d5..a8a2d95 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);





More information about the tor-commits mailing list