(That operation increases the amount of data displayed on screen,
but failed to trigger a realloc of the buffer used to hold that data
during display.)
git-svn-id: svn://svn.tartarus.org/sgt/tweak@7478
cda61777-01e9-0310-a592-
d414129be87e
}
static unsigned char *scrbuf = NULL;
}
static unsigned char *scrbuf = NULL;
-static int scrbuflines = 0;
+static int scrbufsize = 0;
/*
* Draw the screen, for normal usage.
/*
* Draw the screen, for normal usage.
char *linebuf;
scrlines = display_rows - 2;
char *linebuf;
scrlines = display_rows - 2;
- if (scrlines > scrbuflines) {
- scrbuf = (scrbuf ?
- realloc(scrbuf, scrlines*width) :
- malloc(scrlines*width));
+ scrsize = scrlines * width;
+ if (scrsize > scrbufsize) {
+ scrbuf = (scrbuf ? realloc(scrbuf, scrsize) : malloc(scrsize));
if (!scrbuf) {
done();
fprintf(stderr, "%s: out of memory!\n", pname);
exit (2);
}
if (!scrbuf) {
done();
fprintf(stderr, "%s: out of memory!\n", pname);
exit (2);
}
- scrbuflines = scrlines;
}
linebuf = malloc(width*4+20);
}
linebuf = malloc(width*4+20);
scroff = width - offset;
else
scroff = 0;
scroff = width - offset;
else
scroff = 0;
- scrsize = scrlines * width - scroff;
if (scrsize > file_size - top_pos)
scrsize = file_size - top_pos;
if (scrsize > file_size - top_pos)
scrsize = file_size - top_pos;