possible wasted memory in list_read.c

Steve Kargl sgk@troutmask.apl.washington.edu
Sun Apr 18 00:41:00 GMT 2004


On Sat, Apr 17, 2004 at 11:37:50PM +0100, Paul Brook wrote:
> On Saturday 17 April 2004 23:25, Steve Kargl wrote:
> > On Sat, Apr 17, 2004 at 11:48:46AM -0700, Steve Kargl wrote:
> > > Bud, Paul,
> > >
> > > The following patch removes a possible abuse of memory.
> > > It appears the saved_length is doubled, but then the
> > > actual allocation of memory is 4 times the amount of the
> > > original saved_length.
> >
> > Forget the patch.  I think I know what is going on, but
> > it sure would have been nice to have comment in the code.
> 
> Please do submit comment/documentation patches in cases like this. If you 
> misunderstood this bit of code there's a good chance someone else could do 
> the same. It is important that this sort of apparent wrongness is documented, 
> otherwise it tends to get "corrected" :)
> 

I'm not sure, yet.  It appears the buffer is expanded by 4 times
the original saved_length in case we are parsing a complex number
(ie., 2 real numbers).  But, this is just a guess at the moment.

-- 
Steve



More information about the Fortran mailing list