aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-05-02 03:15:55 +0000
committerRoger Dingledine <arma@torproject.org>2004-05-02 03:15:55 +0000
commit25909c2c29148957022d0b387e0c2f87c7daa1ee (patch)
tree48df86b5eb5acde7ac78659354b9a132b87b22eb
parent138d744247e767fda9ee33eee3b4e5c7d88b8fd0 (diff)
downloadtor-25909c2c29148957022d0b387e0c2f87c7daa1ee.tar.gz
tor-25909c2c29148957022d0b387e0c2f87c7daa1ee.zip
patches on patches
svn:r1763
-rw-r--r--src/or/buffers.c16
-rw-r--r--src/or/connection.c6
-rw-r--r--src/or/or.h3
-rw-r--r--src/or/test.c24
4 files changed, 3 insertions, 46 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c
index 6a37614138..0d5ae890e1 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -115,17 +115,7 @@ static int find_mem_in_mem(const char *str, int str_len,
return -1;
}
-#if 0
-/* Find the first occurence of the string_len byte string 'str' on the
- * buffer 'buf'. If none exists, return -1. Otherwise, return index
- * of the first character on the buffer _after_ the first instance of str.
- */
-int find_on_inbuf(char *str, int string_len, buf_t *buf) {
- return find_mem_in_mem(str, string_len, buf->mem, buf->datalen);
-}
-#endif
-
-/* Create and return a new buf with capacity 'capacity'.
+/* Create and return a new buf with capacity 'size'.
*/
buf_t *buf_new_with_capacity(size_t size) {
buf_t *buf;
@@ -257,7 +247,7 @@ int read_to_buf_tls(tor_tls *tls, size_t at_most, buf_t *buf) {
/* Write data from 'buf' to the socket 's'. Write at most
* *buf_flushlen bytes, and decrement *buf_flushlen by the number of
* bytes actually written. Return the number of bytes written on
- * success, -1 on failure. Returns 0 if write() would block.
+ * success, -1 on failure. Return 0 if write() would block.
*/
int flush_buf(int s, buf_t *buf, int *buf_flushlen)
{
@@ -338,7 +328,7 @@ int write_to_buf(const char *string, int string_len, buf_t *buf) {
/* Remove string_len bytes from the front of 'buf', and store them
- * into 'string'. Returns the new buffer size. string_len must be <=
+ * into 'string'. Return the new buffer size. string_len must be <=
* the number of bytes on the buffer.
*/
int fetch_from_buf(char *string, size_t string_len, buf_t *buf) {
diff --git a/src/or/connection.c b/src/or/connection.c
index ebe1430c5c..6f69799cd2 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -655,12 +655,6 @@ int connection_fetch_from_buf(char *string, int len, connection_t *conn) {
return fetch_from_buf(string, len, conn->inbuf);
}
-/*
-int connection_find_on_inbuf(char *string, int len, connection_t *conn) {
- return find_on_inbuf(string, len, conn->inbuf);
-}
-*/
-
int connection_wants_to_flush(connection_t *conn) {
return conn->outbuf_flushlen;
}
diff --git a/src/or/or.h b/src/or/or.h
index 76d99170df..b0c8fa6de0 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -646,8 +646,6 @@ struct socks_request_t {
/********************************* buffers.c ***************************/
-/* int find_on_inbuf(char *string, int string_len, buf_t *buf); */
-
buf_t *buf_new();
buf_t *buf_new_with_capacity(size_t size);
void buf_free(buf_t *buf);
@@ -802,7 +800,6 @@ int connection_handle_read(connection_t *conn);
int connection_read_to_buf(connection_t *conn);
int connection_fetch_from_buf(char *string, int len, connection_t *conn);
-/* int connection_find_on_inbuf(char *string, int len, connection_t *conn); */
int connection_wants_to_flush(connection_t *conn);
int connection_outbuf_too_full(connection_t *conn);
diff --git a/src/or/test.c b/src/or/test.c
index 9d1fffc74c..9c8ca78069 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -136,30 +136,6 @@ test_buffers() {
close(s);
-
-#if 0
- /****
- * find_on_inbuf
- ****/
- buf_free(buf);
- buf = buf_new();
- s = open("/tmp/tor_test/data", O_RDONLY, 0);
- eof = 0;
- i = read_to_buf(s, 1024, buf, &eof);
- test_eq(256, i);
- close(s);
-
- test_eq(((int)'d') + 1, find_on_inbuf("abcd", 4, buf));
- test_eq(-1, find_on_inbuf("xyzzy", 5, buf));
- /* Make sure we don't look off the end of the buffef */
- ((char*)_buf_peek_raw_buffer(buf))[256] = 'A';
- ((char*)_buf_peek_raw_buffer(buf))[257] = 'X';
- test_eq(-1, find_on_inbuf("\xff" "A", 2, buf));
- test_eq(-1, find_on_inbuf("AX", 2, buf));
- /* Make sure we use the string length */
- test_eq(((int)'d')+1, find_on_inbuf("abcdX", 4, buf));
-#endif
-
/****
* fetch_from_buf
****/