aboutsummaryrefslogtreecommitdiffstats
path: root/util/iobuf.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--util/iobuf.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/util/iobuf.c b/util/iobuf.c
index 0f534fadf..09eda49e7 100644
--- a/util/iobuf.c
+++ b/util/iobuf.c
@@ -44,6 +44,12 @@
#include "dynload.h"
#include "iobuf.h"
+/* The size of the internal buffers.
+ NOTE: If you change this value you MUST also adjust the regression
+ test "armored_key_8192" in armor.test! */
+#define IOBUF_BUFFER_SIZE 8192
+
+
#undef FILE_FILTER_USES_STDIO
#ifdef HAVE_DOSISH_SYSTEM
@@ -983,7 +989,7 @@ iobuf_temp()
{
IOBUF a;
- a = iobuf_alloc(3, 8192 );
+ a = iobuf_alloc(3, IOBUF_BUFFER_SIZE );
return a;
}
@@ -1063,7 +1069,7 @@ iobuf_open( const char *fname )
return iobuf_fdopen ( translate_file_handle (fd,0), "rb" );
else if( (fp = my_fopen_ro(fname, "rb")) == INVALID_FP )
return NULL;
- a = iobuf_alloc(1, 8192 );
+ a = iobuf_alloc(1, IOBUF_BUFFER_SIZE );
fcx = xmalloc( sizeof *fcx + strlen(fname) );
fcx->fp = fp;
fcx->print_only_name = print_only;
@@ -1099,7 +1105,7 @@ iobuf_fdopen( int fd, const char *mode )
#else
fp = (FILEP_OR_FD)fd;
#endif
- a = iobuf_alloc( strchr( mode, 'w')? 2:1, 8192 );
+ a = iobuf_alloc( strchr( mode, 'w')? 2:1, IOBUF_BUFFER_SIZE );
fcx = xmalloc( sizeof *fcx + 20 );
fcx->fp = fp;
fcx->print_only_name = 1;
@@ -1123,7 +1129,7 @@ iobuf_sockopen ( int fd, const char *mode )
sock_filter_ctx_t *scx;
size_t len;
- a = iobuf_alloc( strchr( mode, 'w')? 2:1, 8192 );
+ a = iobuf_alloc( strchr( mode, 'w')? 2:1, IOBUF_BUFFER_SIZE );
scx = xmalloc( sizeof *scx + 25 );
scx->sock = fd;
scx->print_only_name = 1;
@@ -1166,7 +1172,7 @@ iobuf_create( const char *fname )
return iobuf_fdopen ( translate_file_handle (fd, 1), "wb" );
else if( (fp = my_fopen(fname, "wb")) == INVALID_FP )
return NULL;
- a = iobuf_alloc(2, 8192 );
+ a = iobuf_alloc(2, IOBUF_BUFFER_SIZE );
fcx = xmalloc( sizeof *fcx + strlen(fname) );
fcx->fp = fp;
fcx->print_only_name = print_only;
@@ -1201,7 +1207,7 @@ iobuf_append( const char *fname )
return NULL;
else if( !(fp = my_fopen(fname, "ab")) )
return NULL;
- a = iobuf_alloc(2, 8192 );
+ a = iobuf_alloc(2, IOBUF_BUFFER_SIZE );
fcx = xmalloc( sizeof *fcx + strlen(fname) );
fcx->fp = fp;
strcpy(fcx->fname, fname );
@@ -1229,7 +1235,7 @@ iobuf_openrw( const char *fname )
return NULL;
else if( (fp = my_fopen(fname, "r+b")) == INVALID_FP )
return NULL;
- a = iobuf_alloc(2, 8192 );
+ a = iobuf_alloc(2, IOBUF_BUFFER_SIZE );
fcx = xmalloc( sizeof *fcx + strlen(fname) );
fcx->fp = fp;
strcpy(fcx->fname, fname );
@@ -1582,7 +1588,7 @@ iobuf_flush(IOBUF a)
if( a->use == 3 ) { /* increase the temp buffer */
char *newbuf;
- size_t newsize = a->d.size + 8192;
+ size_t newsize = a->d.size + IOBUF_BUFFER_SIZE;
if( DBG_IOBUF )
log_debug("increasing temp iobuf from %lu to %lu\n",