Mail Archives: djgpp-workers/1999/05/24/10:51:19
Dear Eli Zaretskii,
On 05-23-99 at 05:34:27 EST you wrote:
>
>
> I don't know how `_msize' works, so I'm not sure what would be its
> equivalent in DJGPP. Does it work on the `malloc' level or on the
> `sbrk' level?
>
In malloc.c, the defining memory structure (at this writing) is:
typedef struct BLOCK {
int size;
struct BLOCK *next;
int bucket;
} BLOCK;
The following mini-function returns the size of the block allocated
by malloc:
/* memsize - return size of block (in bytes) allocated by malloc */
size_t
memsize(void * ptr)
{
return ((BLOCK *)((char *)ptr-4))->size & ~1;
}
As DJ Delorie wrote on 05-23-99 at 19:01:15 EST:
>
> Don't forget malloc() changed in 2.02! It could change at any time.
So, it behooves a developer to be on the alert when a new version of
the library is established.
Perhaps a short function like the one above could be added to malloc.c?
K.B. Williams
- Raw text -