[comp.sys.mac.programmer] LSC malloc

nf0i+@andrew.cmu.edu (Norman William Franke, III) (09/17/89)

I'm porting an editor from a Unix machine to Think C 4.0, and I have run into
a problem with malloc. The program seems to handle a number of malloc calls
successfully (none are that large), but there is one it always dies on.
I'm asking for about 25 bytes of space, and goes into an infinite loop.
I renamed all the malloc calls something else, and loaded the source for
malloc (that Think provided) and renamed it as well so I could see where
it dies. It gets to this assembly sniplet:

                /*  coalesce free blocks  */

            asm {
                    moveq   #0,d1
*   @41             add.w   d1,d0
*                   move.w  0(a0,d0.w),d1
*                   bpl.s   @41
                    move.w  d0,(a0)
                    cmp.w   size,d0
                    blo.s   @31             ;  block too small
            }

And then repeats the "*"d lines forever. I don't understand this, does
anyone know what's up? This is really annoying me...
And on a semi-related note, I think Think C should have an option to let
one set the integer size. Almost everything uses 32 bits ints, and some
things depend on them...


Thanks,

nf0i+@andrew.cmu.edu                                            Norman Franke