Mail Archives: djgpp-workers/2001/01/08/00:18:46
>
> On Fri, 5 Jan 2001, Mark E. wrote:
>
> > + /* Temporarily clear chunk-in-use bit so macros work correctly. */
> > + b1->size &= ~1;
>
> Isn't this a bit dangerous? Doesn't it leave the malloc chain in an
> inconsistent state, for a small window of opportunities? What if some
> signal (i.e. exception) strikes between this line and where you restore
> the bit, and the code run from the signal handler calls memalign?
I hadn't thought of that. Would adding '& ~1' to BEFSZ, ENDSZ, etc. work for
you?
BTW, the code I posted didn't handle block->size == 0 correctly (sigh). I
created a test program that would expose the slightest flaw and finally
managed to fix it. The upshot is please don't anyone use it with gcc yet.
Mark
- Raw text -