* src/grep.c (reset, main): We're going to need pagesize and buffer
initialized anyway, so we might as well do so unconditionally early on
rather than checking on every call to reset().
---
src/grep.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/src/grep.c b/src/grep.c
index d01bc4f..302e4d7 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -769,16 +769,6 @@ all_zeros (char const *buf, size_t size)
static bool
reset (int fd, struct stat const *st)
{
- if (! pagesize)
- {
- pagesize = getpagesize ();
- if (pagesize == 0 || 2 * pagesize + 1 <= pagesize)
- abort ();
- bufalloc = (ALIGN_TO (INITIAL_BUFSIZE, pagesize)
- + pagesize + sizeof (uword));
- buffer = xmalloc (bufalloc);
- }
-
bufbeg = buflim = ALIGN_TO (buffer + 1, pagesize);
bufbeg[-1] = eolbyte;
bufdesc = fd;
@@ -2252,6 +2242,12 @@ main (int argc, char **argv)
set_program_name (argv[0]);
program_name = argv[0];
+ pagesize = getpagesize ();
+ if (pagesize == 0 || 2 * pagesize + 1 <= pagesize)
+ abort ();
+ bufalloc = (ALIGN_TO (INITIAL_BUFSIZE, pagesize) + pagesize + sizeof
(uword));
+ buffer = xmalloc (bufalloc);
+
keys = NULL;
keycc = 0;
with_filenames = false;
--
2.8.0.rc3