summaryrefslogtreecommitdiff
path: root/src/common/buffers.h
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/common/buffers.h
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/common/buffers.h')
-rw-r--r--src/common/buffers.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/common/buffers.h b/src/common/buffers.h
index 7666f1895a..0db4f771d6 100644
--- a/src/common/buffers.h
+++ b/src/common/buffers.h
@@ -35,20 +35,20 @@ size_t buf_slack(const buf_t *buf);
uint32_t buf_get_oldest_chunk_timestamp(const buf_t *buf, uint32_t now);
size_t buf_get_total_allocation(void);
-int buf_read_from_socket(tor_socket_t s, size_t at_most, buf_t *buf,
+int buf_read_from_socket(buf_t *buf, tor_socket_t s, size_t at_most,
int *reached_eof,
int *socket_error);
-int buf_flush_to_socket(tor_socket_t s, buf_t *buf, size_t sz,
+int buf_flush_to_socket(buf_t *buf, tor_socket_t s, size_t sz,
size_t *buf_flushlen);
-int buf_add(const char *string, size_t string_len, buf_t *buf);
+int buf_add(buf_t *buf, const char *string, size_t string_len);
int buf_add_compress(buf_t *buf, struct tor_compress_state_t *state,
const char *data, size_t data_len, int done);
int buf_move_to_buf(buf_t *buf_out, buf_t *buf_in, size_t *buf_flushlen);
-void buf_peek(char *string, size_t string_len, const buf_t *buf);
+void buf_peek(const buf_t *buf, char *string, size_t string_len);
void buf_drain(buf_t *buf, size_t n);
-int buf_get_bytes(char *string, size_t string_len, buf_t *buf);
+int buf_get_bytes(buf_t *buf, char *string, size_t string_len);
int buf_get_line(buf_t *buf, char *data_out, size_t *data_len);
#define PEEK_BUF_STARTSWITH_MAX 16