vcs-svn: eliminate global byte_buffer
The data stored in byte_buffer[] is always either discarded or written to stdout immediately. No need for it to persist between function calls. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Jonathan Nieder committed
Oct 10, 2010 at 21:37 UTC
4d21bec0d2c2f83e3f1e84edae5a3259cdab862f
1 file changed
+2
-1
vcs-svn/line_buffer.c
+2
-1
@@ -14,7 +14,6 @@
14
obj_pool_gen(blob, char, 4096)
15
16
static char line_buffer[LINE_BUFFER_LEN];
17
-static char byte_buffer[COPY_BUFFER_LEN];
17
static FILE *infile;
18
19
int buffer_init(const char *filename)
@@ -68,6 +67,7 @@ char *buffer_read_string(uint32_t len)
67
68
void buffer_copy_bytes(uint32_t len)
69
{
70
+ char byte_buffer[COPY_BUFFER_LEN];
71
uint32_t in;
72
while (len > 0 && !feof(infile) && !ferror(infile)) {
73
in = len < COPY_BUFFER_LEN ? len : COPY_BUFFER_LEN;
@@ -83,6 +83,7 @@ void buffer_copy_bytes(uint32_t len)
83
84
void buffer_skip_bytes(uint32_t len)
85
{
86
+ char byte_buffer[COPY_BUFFER_LEN];
87
uint32_t in;
88
while (len > 0 && !feof(infile) && !ferror(infile)) {
89
in = len < COPY_BUFFER_LEN ? len : COPY_BUFFER_LEN;