Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Nov 2009 21:18:53 GMT
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 171209 for review
Message-ID:  <200911302118.nAULIrqU019330@repoman.freebsd.org>

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

Change 171209 by gabor@gabor_server on 2009/11/30 21:18:28

	- Change order of if's and for's so that conditions are only
	  checked once

Affected files ...

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

Differences ...

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

@@ -609,11 +609,12 @@
  * XXX: fgrepcomp() and fastcomp() are workarounds for regexec() performance.
  * Optimizations should be done there.
  */
-	for (i = 0; i < patterns; ++i) {
 		/* Check if cheating is allowed (always is for fgrep). */
-		if (grepbehave == GREP_FIXED)
+	if (grepbehave == GREP_FIXED) {
+		for (i = 0; i < patterns; ++i)
 			fgrepcomp(&fg_pattern[i], pattern[i]);
-		else {
+	} else {
+		for (i = 0; i < patterns; ++i) {
 			if (fastcomp(&fg_pattern[i], pattern[i])) {
 				/* Fall back to full regex library */
 				c = regcomp(&r_pattern[i], pattern[i], cflags);



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