From 809c33aadd4d94bd1b06b18dd5833f589564329b Mon Sep 17 00:00:00 2001 From: simonb Date: Wed, 5 Sep 2012 04:01:23 +0000 Subject: [PATCH] Use getc instead of fgetc. This is approximately five times faster for "comm -23 a b" where a and b are identical 100MB files. --- usr.bin/comm/comm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/comm/comm.c b/usr.bin/comm/comm.c index 58ae9af552db..c1416e2db971 100644 --- a/usr.bin/comm/comm.c +++ b/usr.bin/comm/comm.c @@ -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, 1993, 1994\ #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 @@ -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)