Skip to content

Commit

Permalink
vcs-svn: eliminate global byte_buffer
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jrn committed Feb 26, 2011
1 parent 8dc6a37 commit 4d21bec
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vcs-svn/line_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
obj_pool_gen(blob, char, 4096)

static char line_buffer[LINE_BUFFER_LEN];
static char byte_buffer[COPY_BUFFER_LEN];
static FILE *infile;

int buffer_init(const char *filename)
Expand Down Expand Up @@ -68,6 +67,7 @@ char *buffer_read_string(uint32_t len)

void buffer_copy_bytes(uint32_t len)
{
char byte_buffer[COPY_BUFFER_LEN];
uint32_t in;
while (len > 0 && !feof(infile) && !ferror(infile)) {
in = len < COPY_BUFFER_LEN ? len : COPY_BUFFER_LEN;
Expand All @@ -83,6 +83,7 @@ void buffer_copy_bytes(uint32_t len)

void buffer_skip_bytes(uint32_t len)
{
char byte_buffer[COPY_BUFFER_LEN];
uint32_t in;
while (len > 0 && !feof(infile) && !ferror(infile)) {
in = len < COPY_BUFFER_LEN ? len : COPY_BUFFER_LEN;
Expand Down

0 comments on commit 4d21bec

Please sign in to comment.