Module Name: src
Committed By: simonb
Date: Wed Sep 5 04:01:23 UTC 2012
Modified Files:
src/usr.bin/comm: comm.c
Log Message:
Use getc instead of fgetc.
This is approximately five times faster for "comm -23 a b" where a and b
are identical 100MB files.
To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/comm/comm.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/comm/comm.c
diff -u src/usr.bin/comm/comm.c:1.19 src/usr.bin/comm/comm.c:1.20
--- src/usr.bin/comm/comm.c:1.19 Tue Aug 30 21:36:38 2011
+++ src/usr.bin/comm/comm.c Wed Sep 5 04:01:23 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: comm.c,v 1.19 2011/08/30 21:36:38 joerg Exp $ */
+/* $NetBSD: comm.c,v 1.20 2012/09/05 04:01:23 simonb Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
#if 0
static char sccsid[] = "@(#)comm.c 8.4 (Berkeley) 5/4/95";
#endif
-__RCSID("$NetBSD: comm.c,v 1.19 2011/08/30 21:36:38 joerg Exp $");
+__RCSID("$NetBSD: comm.c,v 1.20 2012/09/05 04:01:23 simonb Exp $");
#endif /* not lint */
#include <err.h>
@@ -197,7 +197,7 @@ getnextln(char *buf, FILE *fp)
size_t i = 0;
int c;
- while ((c = fgetc(fp)) != '\n' && c != EOF) {
+ while ((c = getc(fp)) != '\n' && c != EOF) {
buf[i++] = c;
if (i >= MAXLINELEN)