On Tue, Sep 06, 2005 at 09:49:12PM +0100, Colm MacCarthaigh wrote:
> It supports increasing and decreasing the buffer size, as well as making
> an unbuffered file handle buffered, and a buffered file unbuffered.
> 
> The patch also adds a new subpool to the file handle, for the buffer
> itself, with the subpool being destroyed on buffer resizes.

A subpool is an extra 8K of allocated memory for something the caller 
might not need, I don't think this is a good idea.

I wonder if it would be better to simply allow the caller to choose and 
manage the buffer allocation appropriately, a la stdio setbuf/setvbuf; 
making the interface something like:

  apr_file_set_buffer(apr_file_t *file, char *buffer, apr_size_t buflen)

> Other things I'm thinking about;
> 
>       Destroying the subpool on apr_file_close, after all the lifetime
>       of the buffer should be exactly concurrent with the lifetime of
>       the file descriptor.
> 
>       Maybe making something like;
> 
>               apr_file_set_default_buffer_size(apr_off_t foo); 

insert "global state sucks" rant here :) (sizes of things in memory 
should always be apr_size_t not apr_off_t btw)

joe

Reply via email to