PERFORCE change 163495 for review

Gabor Kovesdan gabor at FreeBSD.org
Thu Jun 4 15:27:54 UTC 2009


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

Change 163495 by gabor at gabor_server on 2009/06/04 15:27:26

	- C99-ify bool variable
	- style

Affected files ...

.. //depot/projects/soc2008/gabor_textproc/grep/file.c#45 edit
.. //depot/projects/soc2008/gabor_textproc/grep/grep.h#51 edit

Differences ...

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

@@ -131,7 +131,7 @@
 
 		/* Only pre-read to the buffer if we need the binary check. */
 		if (binbehave != BINFILE_TEXT) {
-			if (f->stdin == 1)
+			if (f->stdin)
 				st.st_size = MAXBUFSIZ;
 			else if (stat(fname, &st) != 0)
 				err(2, NULL);
@@ -147,7 +147,7 @@
 				binbuf[i++] = ch;
 			}
 
-			f->binary = memchr(binbuf, (filebehave != FILE_GZIP) ? '\0' : '\200', i - 1) != 0;
+			f->binary = memchr(binbuf, (filebehave != FILE_GZIP) ? '\0' : '\200', i - 1) != NULL;
 		}
 		binbufsiz = i;
 		binbufptr = binbuf;
@@ -190,7 +190,7 @@
 	f = grep_malloc(sizeof *f);
 
 	if ((f->f = fdopen(STDIN_FILENO, "r")) != NULL) {
-		f->stdin = 1;
+		f->stdin = true;
 		return (f);
 	}
 
@@ -210,7 +210,7 @@
 
 	f = grep_malloc(sizeof *f);
 
-	f->stdin = 0;
+	f->stdin = false;
 	switch (filebehave) {
 	case FILE_STDIO:
 		if ((f->f = fopen(path, "r")) != NULL)

==== //depot/projects/soc2008/gabor_textproc/grep/grep.h#51 (text+ko) ====

@@ -78,8 +78,8 @@
 #define MAX_LINE_MATCHES	32
 
 struct file {
-	int		 binary;
-	int		 stdin;
+	bool		 binary;
+	bool		 stdin;
 	FILE		*f;
 	struct mmfile	*mmf;
 	gzFile		*gzf;


More information about the p4-projects mailing list