Skip to content

Commit

Permalink
vcs-svn: improve support for reading large files
Browse files Browse the repository at this point in the history
Move from uint32_t to off_t as the fundamental unit of length used by
the line_buffer library.  Performance would get worse if anything but
I think it's worth it for support of deltas that need to skip large
pieces (> 4 GiB).

Exception: buffer_read_string still takes a uint32_t, since it keeps
its result in an in-core obj_pool.

Callers still have to be updated to take advantage of this.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
  • Loading branch information
Jonathan Nieder committed Mar 22, 2011
1 parent efc749b commit 93b709c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions vcs-svn/line_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void buffer_read_binary(struct line_buffer *buf,
strbuf_fread(sb, size, buf->infile);
}

void buffer_copy_bytes(struct line_buffer *buf, uint32_t len)
void buffer_copy_bytes(struct line_buffer *buf, off_t len)
{
char byte_buffer[COPY_BUFFER_LEN];
uint32_t in;
Expand All @@ -120,7 +120,7 @@ void buffer_copy_bytes(struct line_buffer *buf, uint32_t len)
}
}

void buffer_skip_bytes(struct line_buffer *buf, uint32_t len)
void buffer_skip_bytes(struct line_buffer *buf, off_t len)
{
char byte_buffer[COPY_BUFFER_LEN];
uint32_t in;
Expand Down
4 changes: 2 additions & 2 deletions vcs-svn/line_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ char *buffer_read_line(struct line_buffer *buf);
char *buffer_read_string(struct line_buffer *buf, uint32_t len);
int buffer_read_char(struct line_buffer *buf);
void buffer_read_binary(struct line_buffer *buf, struct strbuf *sb, uint32_t len);
void buffer_copy_bytes(struct line_buffer *buf, uint32_t len);
void buffer_skip_bytes(struct line_buffer *buf, uint32_t len);
void buffer_copy_bytes(struct line_buffer *buf, off_t len);
void buffer_skip_bytes(struct line_buffer *buf, off_t len);

#endif

0 comments on commit 93b709c

Please sign in to comment.