[or-cvs] patches on patches

Roger Dingledine arma at seul.org
Sun May 2 03:15:57 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	buffers.c connection.c or.h test.c 
Log Message:
patches on patches


Index: buffers.c
===================================================================
RCS file: /home/or/cvsroot/src/or/buffers.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- buffers.c	1 May 2004 22:08:43 -0000	1.87
+++ buffers.c	2 May 2004 03:15:55 -0000	1.88
@@ -115,17 +115,7 @@
   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 @@
 /* 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 @@
 
 
 /* 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) {

Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.208
retrieving revision 1.209
diff -u -d -r1.208 -r1.209
--- connection.c	1 May 2004 22:08:43 -0000	1.208
+++ connection.c	2 May 2004 03:15:55 -0000	1.209
@@ -655,12 +655,6 @@
   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;
 }

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.328
retrieving revision 1.329
diff -u -d -r1.328 -r1.329
--- or.h	1 May 2004 22:08:43 -0000	1.328
+++ or.h	2 May 2004 03:15:55 -0000	1.329
@@ -646,8 +646,6 @@
 
 /********************************* 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_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);

Index: test.c
===================================================================
RCS file: /home/or/cvsroot/src/or/test.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- test.c	1 May 2004 22:08:43 -0000	1.87
+++ test.c	2 May 2004 03:15:55 -0000	1.88
@@ -136,30 +136,6 @@
 
   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
    ****/



More information about the tor-commits mailing list