[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] put small buffers back in place



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

Modified Files:
	buffers.c 
Log Message:
put small buffers back in place


Index: buffers.c
===================================================================
RCS file: /home/or/cvsroot/src/or/buffers.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- buffers.c	17 Oct 2003 10:00:01 -0000	1.50
+++ buffers.c	19 Oct 2003 01:10:38 -0000	1.51
@@ -6,27 +6,27 @@
 
 #include "or.h"
 
-extern or_options_t options; /* command-line and config-file options */
-
 struct buf_t {
   char *mem;
   size_t len;
   size_t datalen;
 };
+
 /* Size, in bytes, for newly allocated buffers.  Should be a power of 2. */
-#define INITIAL_BUF_SIZE (512*1024) /* used to be 4*1024 */
+#define INITIAL_BUF_SIZE (4*1024)
 /* Maximum size, in bytes, for resized buffers. */
 #define MAX_BUF_SIZE (1024*1024)
 /* Size, in bytes, for minimum 'shrink' size for buffers.  Buffers may start
  * out smaller than this, but they will never autoshrink to less
  * than this size. */
-#define MIN_BUF_SHRINK_SIZE (512*1024) /* used to be 16*1024 */
+#define MIN_BUF_SHRINK_SIZE (16*1024)
 #define BUF_OK(b) ((b) && (b)->mem && (b)->datalen <= (b)->len)
 
 /* Change a buffer's capacity.  Must only be called when */
 static INLINE void buf_resize(buf_t *buf, size_t new_capacity)
 {
   assert(buf->datalen <= new_capacity);
+  assert(new_capacity);
   buf->mem = tor_realloc(buf->mem, new_capacity);
   buf->len = new_capacity;
 }
@@ -153,8 +153,6 @@
   free(buf->mem);
   free(buf);
 }
-
-
 
 /* read from socket s, writing onto end of buf.
  * read at most 'at_most' bytes, and in any case don't read more than will fit based on buflen.