PERFORCE change 171209 for review

Gabor Kovesdan gabor at FreeBSD.org
Mon Nov 30 21:18:54 UTC 2009


http://p4web.freebsd.org/chv.cgi?CH=171209

Change 171209 by gabor at 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);


More information about the p4-projects mailing list