This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Incorrect _Kmax value


On Feb 11 16:33, Aleksandr Platonov wrote:
> On Thu, 2011-02-10 at 18:32 +0100, Corinna Vinschen wrote:
> > On Feb 10 19:04, Aleksandr Platonov wrote:
> > > Hi,
> > > _Kmax is defined as (sizeof (size_t) << 3) and means the maximum
> index
> > > value of _REENT->_freelist array.
> > > If the size of size_t is equal to 4 then Balloc(prt, _Kmax - 1) call
> > > sets _maxwds to negative value. Balloc(ptr, _Kmax) call allocates
> memory
> > > for sizeof (_Bigint) - sizeof(rv->_x) bytes and sets _maxwds to 0.
> > 
> > When, where and why should this happen?
> I do not know when Balloc() could be called with k parameter equal to 31
> or 32. But if this should *not* happen then why do we allocate 33 (_Kmax
> + 1) _Bigint pointers for _REENT->_freelist array at the first Balloc()
> call? In this case the last two elements of _REENT->_freelist will be
> unused.

I can't tell, maybe somebody else knows this.  As it happens, the
freelist is allocated using the same size as the freelist in NetBSD.


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]