Quoth NRK :
> > + while (i < n && (c = fgetc(fp)) != EOF) {
> > + if (fputc(c, stdout) == EOF)
>
> I don't see this as an improvement. Each one of the fgetc and fputc are
> going to go through a mutex lock (along with possibly going through a
> call into a dynamic function).
These kin
> + while (i < n && (c = fgetc(fp)) != EOF) {
> + if (fputc(c, stdout) == EOF)
I don't see this as an improvement. Each one of the fgetc and fputc are
going to go through a mutex lock (along with possibly going through a
call into a dynamic function).
I think the current solution
getline isn't useful here, because we just need to read then output
lines. We do not need anything more complex than counting '\n's, so
we shouldn't use a buffer like we currently do.
---
head.c | 15 ---
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/head.c b/head.c
ind