Re: Increase BUFSIZ to 8192

From: John-Mark Gurney <jmg_at_funkthat.com>
Date: Thu, 14 May 2015 00:53:16 -0700
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."
Received on Thu May 14 2015 - 05:53:18 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:57 UTC