I confirmed an additional byte isn't required at the top of an input
buffer.  However, I also confirmed an additional byte is required at the
end of the input buffer.  dfaexec will temporarily replace it with
eolbyte as sentinel.

Sorry, I changed the patch again.
From 71bc6a65dcc0f42cb5b2c311ac2d5846a2669d01 Mon Sep 17 00:00:00 2001
From: Norihiro Tanaka <nori...@kcn.ne.jp>
Date: Fri, 3 Oct 2014 07:53:06 +0900
Subject: [PATCH] grep: testing matching with an eolbyte, add a byte to the end
 of an input buffer

src/grep.c (grep): Testing matching with an eolbyte, add a byte to the
end of an input buffer.
---
 src/grep.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/grep.c b/src/grep.c
index bb5ba1c..7475ea1 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -2513,8 +2513,9 @@ main (int argc, char **argv)
 
   compile (keys, keycc);
   free (keys);
+  char eolbytes[2] = { eolbyte };
   size_t match_size;
-  skip_empty_lines = ((execute (&eolbyte, 1, &match_size, NULL) == 0)
+  skip_empty_lines = ((execute (eolbytes, 1, &match_size, NULL) == 0)
                       == out_invert);
 
   if ((argc - optind > 1 && !no_filenames) || with_filenames)
-- 
2.1.1

Reply via email to