=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/Attic/buffer.c,v retrieving revision 1.16.4.3 retrieving revision 1.17 diff -u -r1.16.4.3 -r1.17 --- src/usr.bin/ssh/Attic/buffer.c 2004/03/04 18:18:15 1.16.4.3 +++ src/usr.bin/ssh/Attic/buffer.c 2003/09/16 03:03:47 1.17 @@ -12,7 +12,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: buffer.c,v 1.16.4.3 2004/03/04 18:18:15 brad Exp $"); +RCSID("$OpenBSD: buffer.c,v 1.17 2003/09/16 03:03:47 deraadt Exp $"); #include "xmalloc.h" #include "buffer.h" @@ -23,11 +23,8 @@ void buffer_init(Buffer *buffer) { - const u_int len = 4096; - - buffer->alloc = 0; - buffer->buf = xmalloc(len); - buffer->alloc = len; + buffer->alloc = 4096; + buffer->buf = xmalloc(buffer->alloc); buffer->offset = 0; buffer->end = 0; } @@ -37,11 +34,8 @@ void buffer_free(Buffer *buffer) { - if (buffer->alloc > 0) { - memset(buffer->buf, 0, buffer->alloc); - buffer->alloc = 0; - xfree(buffer->buf); - } + memset(buffer->buf, 0, buffer->alloc); + xfree(buffer->buf); } /* @@ -105,7 +99,7 @@ goto restart; } /* Increase the size of the buffer and retry. */ - + newlen = buffer->alloc + len + 32768; if (newlen > 0xa00000) fatal("buffer_append_space: alloc %u not supported", @@ -169,7 +163,7 @@ void buffer_dump(Buffer *buffer) { - u_int i; + int i; u_char *ucp = buffer->buf; for (i = buffer->offset; i < buffer->end; i++) {