Re: [hackers] [sbase][PATCH] head: remove useless buffering

2024-12-19 Thread Roberto E . Vargas Caballero
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

Re: [hackers] [sbase][PATCH] head: remove useless buffering

2024-03-05 Thread 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). I think the current solution

[hackers] [sbase][PATCH] head: remove useless buffering

2024-03-05 Thread Elie Le Vaillant
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