Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Aug 2008 11:47:25 GMT
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 147076 for review
Message-ID:  <200808101147.m7ABlPcX084765@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=147076

Change 147076 by gabor@gabor_server on 2008/08/10 11:47:24

	- Fall back to regexec() if --color or -o is set because the fixed
	  string code doesn't handle them.  If I can fix it then
	  we can revert this change.

Affected files ...

.. //depot/projects/soc2008/gabor_textproc/grep/grep.c#73 edit

Differences ...

==== //depot/projects/soc2008/gabor_textproc/grep/grep.c#73 (text+ko) ====

@@ -599,10 +599,13 @@
  */
 		for (i = 0; i < patterns; ++i) {
 			/* Check if cheating is allowed (always is for fgrep). */
-			if (grepbehave == GREP_FIXED)
+			if (grepbehave == GREP_FIXED && !color && !oflag)
 				fgrepcomp(&fg_pattern[i], pattern[i]);
 			else {
+				if (oflag || color)
+					goto fallback;
 				if (fastcomp(&fg_pattern[i], pattern[i])) {
+fallback:
 					/* Fall back to full regex library */
 					c = regcomp(&r_pattern[i], pattern[i], cflags);
 					if (c != 0) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808101147.m7ABlPcX084765>