Bug#215448: di_mem_chunk_alloc() should return sizeof(long) or better alignment
First, IMHO we should drop this stuff and just use malloc. I don't see
any point in increasing code size and introducing new bugs thereby.
Anyway:
> struct di_mem_area
> {
> di_mem_area *next; /**< the next mem area */
> di_mem_area *prev; /**< the previous mem area */
> di_ksize_t index; /**< the current index into the "mem" array */
> di_ksize_t free; /**< the number of free bytes in this mem area */
> di_ksize_t allocated; /**< the number of atoms allocated from this area */
> char mem[MEM_AREA_SIZE]; /**< the mem array from which atoms get allocated
> * the actual size of this array is determined by
> * the mem chunk "area_size". ANSI says that it
> * must be declared to be the maximum size it
> * can possibly be (even though the actual size
> * may be less).
> */
> };
>
>
> I also wonder about MEM_AREA_SIZE being hardwired at 4, although I
> didn't dig in to the code far enough to see if it should be 8 on 64
> bit platforms.
Just use long mem[] there, we can assume a C99 compiler, and it will
ensure alignment (at least for all Linux platforms).
--
Falk
Reply to: