Fix for line buffers growing too large

pull/37/merge
Timothy Stack 15 years ago
parent abe0182a0b
commit 3f6212766a

@ -24,8 +24,7 @@ endif
AM_LDFLAGS = \
$(SQLITE3_LDFLAGS) \
-pthread \
-static
-pthread
AM_CPPFLAGS = \
-Wall \

@ -206,8 +206,7 @@ noinst_LIBRARIES = libdiag.a
@HAVE_OBJ_FORMAT_TRUE@HELP_SRC =
AM_LDFLAGS = \
$(SQLITE3_LDFLAGS) \
-pthread \
-static
-pthread
AM_CPPFLAGS = \
-Wall \

@ -189,6 +189,7 @@ throw (error)
&this->lb_buffer[prefill],
this->lb_buffer_size);
available = this->lb_buffer_max - this->lb_buffer_size;
if (max_length > available) {
char *tmp, *old;

@ -54,6 +54,13 @@ public:
*/
size_t get_file_size() { return this->lb_file_size; };
off_t get_read_offset(off_t off) {
if (this->lb_gz_file)
return this->lb_gz_offset;
else
return off;
};
/**
* Read up to the end of file or a given delimiter.
*

@ -295,6 +295,8 @@ public:
void logfile_indexing(logfile &lf, off_t off, size_t total)
{
assert(off <= total);
if (abs(off - this->lo_last_offset) > (128 * 1024) ||
(size_t)off == total) {
lnav_data.ld_bottom_source.update_loading(off, total);

@ -163,7 +163,9 @@ throw (line_buffer::error)
last_off = off;
if (lo != NULL) {
lo->logfile_indexing(*this, off, st.st_size);
lo->logfile_indexing(*this,
this->lf_line_buffer.get_read_offset(off),
st.st_size);
}
}

Loading…
Cancel
Save