Increase BUFSIZ to 8192
John-Mark Gurney
jmg at funkthat.com
Thu May 14 07:53:18 UTC 2015
Poul-Henning Kamp wrote this message on Thu, May 14, 2015 at 07:42 +0000:
> --------
> In message <20150514072155.GT37063 at funkthat.com>, John-Mark Gurney writes:
>
> >Since you apprently missed my original reply, I said that we shouldn't
> >abuse BUFSIZ for this work, and that it should be changed in mdXhl.c...
>
> Say what ?
>
> BUFSIZ is used entirely appropriately in MDXFileChunk(): For reading
> a file into an algorithm.
Posix-2008:
BUFSIZ: Size of <stdio.h> buffers. This shall expand to a positive value.
C99:
BUFSIZ
which expands to an integer constant expression that is the size of
the buffer used by the setbuf function;
In fact, posix-2008 references LINE_MAX because:
Frequently, utility writers selected the UNIX system constant BUFSIZ to
allocate these buffers; therefore, some utilities were limited to 512
bytes for I/O lines, while others achieved 4 096 bytes or greater.
BUFSIZ was already recognized as to small to hold a single line, yet
you're saying it's perfectly fine to use as a buffer for binary data?
> If in stead of open(2), fopen(3) had been used, the exact same thing
> would happen, but using malloc space rather than stack space.
Plus extra overhead.. :)
--
John-Mark Gurney Voice: +1 415 225 5579
"All that I will do, has been done, All that I have, has not."
More information about the freebsd-current
mailing list