@matheusbsbs / matheus-bagliano / commits / 93b709c79e
Fork 0

vcs-svn: improve support for reading large files

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>

Jonathan Nieder committed Oct 10, 2010 at 21:46 UTC 93b709c79eea6231b7d75a6817245a416b4f8fb5
2 files changed +4 -4
vcs-svn/line_buffer.c
+2 -2
@@ -104,7 +104,7 @@ void buffer_read_binary(struct line_buffer *buf,
104 strbuf_fread(sb, size, buf->infile);
105 }
106
107 -void buffer_copy_bytes(struct line_buffer *buf, uint32_t len)
107 +void buffer_copy_bytes(struct line_buffer *buf, off_t len)
108 {
109 char byte_buffer[COPY_BUFFER_LEN];
110 uint32_t in;
@@ -120,7 +120,7 @@ void buffer_copy_bytes(struct line_buffer *buf, uint32_t len)
120 }
121 }
122
123 -void buffer_skip_bytes(struct line_buffer *buf, uint32_t len)
123 +void buffer_skip_bytes(struct line_buffer *buf, off_t len)
124 {
125 char byte_buffer[COPY_BUFFER_LEN];
126 uint32_t in;
vcs-svn/line_buffer.h
+2 -2
@@ -26,7 +26,7 @@ char *buffer_read_line(struct line_buffer *buf);
26 char *buffer_read_string(struct line_buffer *buf, uint32_t len);
27 int buffer_read_char(struct line_buffer *buf);
28 void buffer_read_binary(struct line_buffer *buf, struct strbuf *sb, uint32_t len);
29 -void buffer_copy_bytes(struct line_buffer *buf, uint32_t len);
30 -void buffer_skip_bytes(struct line_buffer *buf, uint32_t len);
29 +void buffer_copy_bytes(struct line_buffer *buf, off_t len);
30 +void buffer_skip_bytes(struct line_buffer *buf, off_t len);
31
32 #endif