summaryrefslogtreecommitdiff
path: root/src/or/buffers.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-09-01 14:36:25 -0400
committerNick Mathewson <nickm@torproject.org>2015-09-01 14:36:25 -0400
commitfc191df9304d7fe27ce0c90f75ad4282d43e14e6 (patch)
tree4677585656f0105b5669a7a9ee831297e1fb0784 /src/or/buffers.c
parent0e60c52c6cf1863866a37dcb694823b21898eaf3 (diff)
downloadtor-fc191df9304d7fe27ce0c90f75ad4282d43e14e6.tar.gz
tor-fc191df9304d7fe27ce0c90f75ad4282d43e14e6.zip
Remove the unused "nulterminate" option to buf_pullup()
I was going to add a test for this, but I realized that it had no users. So, removed.
Diffstat (limited to 'src/or/buffers.c')
-rw-r--r--src/or/buffers.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c
index 85fcbc64e8..01a1b1f366 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -182,7 +182,7 @@ preferred_chunk_size(size_t target)
* If <b>nulterminate</b> is true, ensure that there is a 0 byte in
* buf->head->mem right after all the data. */
STATIC void
-buf_pullup(buf_t *buf, size_t bytes, int nulterminate)
+buf_pullup(buf_t *buf, size_t bytes)
{
/* XXXX nothing uses nulterminate; remove it. */
chunk_t *dest, *src;
@@ -194,17 +194,9 @@ buf_pullup(buf_t *buf, size_t bytes, int nulterminate)
if (buf->datalen < bytes)
bytes = buf->datalen;
- if (nulterminate) {
- capacity = bytes + 1;
- if (buf->head->datalen >= bytes && CHUNK_REMAINING_CAPACITY(buf->head)) {
- *CHUNK_WRITE_PTR(buf->head) = '\0';
- return;
- }
- } else {
- capacity = bytes;
- if (buf->head->datalen >= bytes)
- return;
- }
+ capacity = bytes;
+ if (buf->head->datalen >= bytes)
+ return;
if (buf->head->memlen >= capacity) {
/* We don't need to grow the first chunk, but we might need to repack it.*/
@@ -248,11 +240,6 @@ buf_pullup(buf_t *buf, size_t bytes, int nulterminate)
}
}
- if (nulterminate) {
- tor_assert(CHUNK_REMAINING_CAPACITY(buf->head));
- *CHUNK_WRITE_PTR(buf->head) = '\0';
- }
-
check();
}
@@ -1203,7 +1190,7 @@ fetch_from_buf_http(buf_t *buf,
/* Okay, we have a full header. Make sure it all appears in the first
* chunk. */
if ((int)buf->head->datalen < crlf_offset + 4)
- buf_pullup(buf, crlf_offset+4, 0);
+ buf_pullup(buf, crlf_offset+4);
headerlen = crlf_offset + 4;
headers = buf->head->data;
@@ -1451,7 +1438,7 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req,
do {
n_drain = 0;
- buf_pullup(buf, want_length, 0);
+ buf_pullup(buf, want_length);
tor_assert(buf->head && buf->head->datalen >= 2);
want_length = 0;
@@ -1870,7 +1857,7 @@ parse_socks(const char *data, size_t datalen, socks_request_t *req,
*want_length_out = SOCKS4_NETWORK_LEN;
return 0; /* not yet */
}
- // buf_pullup(buf, 1280, 0);
+ // buf_pullup(buf, 1280);
req->command = (unsigned char) *(data+1);
if (req->command != SOCKS_COMMAND_CONNECT &&
req->command != SOCKS_COMMAND_RESOLVE) {
@@ -2038,7 +2025,7 @@ fetch_from_buf_socks_client(buf_t *buf, int state, char **reason)
if (buf->datalen < 2)
return 0;
- buf_pullup(buf, MAX_SOCKS_MESSAGE_LEN, 0);
+ buf_pullup(buf, MAX_SOCKS_MESSAGE_LEN);
tor_assert(buf->head && buf->head->datalen >= 2);
r = parse_socks_client((uint8_t*)buf->head->data, buf->head->datalen,