[Patch, libgfortran] Remove small_buffer, unneccessary buffer for internal I/O

Janne Blomqvist blomqvist.janne@gmail.com
Mon May 21 19:51:00 GMT 2007


:ADDPATCH fortran:

Hi,

the attached patch removes usage of small_buffer in the I/O library, 
instead always using a static buffer. Also, for internal units there is 
no longer a buffer allocated, saving 8K (with the current BUFFER_SIZE) 
of memory.

I'd be grateful if someone has an idea how to combine the identical 
parts of unix_stream and int_stream, as they have to be kept in sync.

Something like

typedef struct
{
    /* common parts.  */
    union
    {
      char buffer[sizeof(size_t)];
      char *intbuf;
    }
}
unix_stream;

would work I suppose; then when allocating a stream for external file 
one would do

   p = malloc (sizeof(unix_stream) + BUFFER_SIZE);

and then scribbling buffer content past the buffer array, so it's 
"cheating" in a way. And the internal units would still be called 
unix_stream, but they would use intbuf instead of buffer.

-- 
Janne Blomqvist
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ChangeLog
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070521/1127d8c5/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: remove-unix_stream-small_buffer.diff
Type: text/x-patch
Size: 6355 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070521/1127d8c5/attachment.bin>


More information about the Fortran mailing list