mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Rename generic_buffer_set_to_copy, since generic buffers are not a thing
This commit is contained in:
+2
-2
@@ -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);
|
||||
|
||||
+3
-2
@@ -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);
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user