PERFORCE change 147076 for review

Gabor Kovesdan gabor at FreeBSD.org
Sun Aug 10 11:47:26 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=147076

Change 147076 by gabor at 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) {


More information about the p4-projects mailing list