PERFORCE change 174404 for review

Gabor Kovesdan gabor at FreeBSD.org
Sat Feb 6 15:04:36 UTC 2010


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

Change 174404 by gabor at gabor_server on 2010/02/06 15:03:57

	- style(9)
	- syntax cleanup

Affected files ...

.. //depot/projects/soc2008/gabor_textproc/grep/util.c#88 edit

Differences ...

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

@@ -60,7 +60,8 @@
 	FTSENT *p;
 	char *d, *dir;
 	unsigned int i;
-	int c, fts_flags, ok;
+	int c, fts_flags;
+	bool ok;
 
 	c = fts_flags = 0;
 
@@ -92,7 +93,7 @@
 			break;
 		default:
 			/* Check for file exclusion/inclusion */
-			ok = 1;
+			ok = true;
 			if (exclflag) {
 				d = strrchr(p->fts_path, '/');
 				dir = grep_malloc(sizeof(char) * (d - p->fts_path + 2));
@@ -100,20 +101,12 @@
 				for (i = 0; i < epatterns; ++i) {
 					switch(epattern[i].type) {
 					case FILE_PAT:
-						if (fnmatch(epattern[i].pat, basename(p->fts_path), 0) == 0) {
-							if (epattern[i].mode == EXCL_PAT)
-								ok = 0;
-							else
-								ok = 1;
-						}
+						if (fnmatch(epattern[i].pat, basename(p->fts_path), 0) == 0)
+							ok = epattern[i].mode != EXCL_PAT;
 						break;
 					case DIR_PAT:
-						if (strstr(dir, epattern[i].pat) != NULL) {
-							if (epattern[i].mode == EXCL_PAT)
-								ok = 0;
-							else
-								ok = 1;
-						}
+						if (strstr(dir, epattern[i].pat) != NULL)
+							ok = epattern[i].mode != EXCL_PAT;
 						break;
 					}
 				}
@@ -408,13 +401,13 @@
 		++n;
 	}
 	if (nflag) {
-		if (n)
+		if (n > 0)
 			putchar(sep);
 		printf("%d", line->line_no);
 		++n;
 	}
 	if (bflag) {
-		if (n)
+		if (n > 0)
 			putchar(sep);
 		printf("%lld", (long long)line->off);
 		++n;


More information about the p4-projects mailing list