AWesome, thank you.

Thanks,
Donald

"Henk Jonas" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Donald C. Kirker wrote:
>
> > Could I possibly get this code as I am having similar issues? My email
is
> > [EMAIL PROTECTED]
> >
>
> MemPtr DebugMemPtrNew(UInt32 size)
> {
>    UInt8 *ptr = MemPtrNew(size + 8); // we have a 4 byte marker in front
> and at the end
>    if (ptr)
>    {
>       ptr[0] = 0xde;
>       ptr[1] = 0xad;
>       ptr[2] = 0xbe;
>       ptr[3] = 0xef;
>
>       ptr[size+4+0] = 0xde;
>       ptr[size+4+1] = 0xad;
>       ptr[size+4+2] = 0xbe;
>       ptr[size+4+3] = 0xef;
>    }
>
>    return ptr+4;
> }
>
>
> void DebugMemPtrFree(MemPtr memptr)
> {
>    UInt8 *ptr = memptr;
>
>    if (ptr)
>    {
>       UInt32 size = 0;
>
>       ptr -= 4;
>
>       size = MemPtrSize(ptr);
>
>       if (ptr[0] != 0xde) Alert("trashed ptr-4");
>       if (ptr[1] != 0xad) Alert("trashed ptr-3");
>       if (ptr[2] != 0xbe) Alert("trashed ptr-2");
>       if (ptr[3] != 0xef) Alert("trashed ptr-1");
>       if (ptr[size - 4] != 0xde) Alert("trashed size-4");
>       if (ptr[size - 3] != 0xad) Alert("trashed size-3");
>       if (ptr[size - 2] != 0xbe) Alert("trashed size-2");
>       if (ptr[size - 1] != 0xef) Alert("trashed size-1");
>
>       MemPtrFree(ptr);
>    }
> }
>
> Regards
> Henk
>
> --
> -------------------------------------------------------------------------
>    Henk Jonas                                            [EMAIL PROTECTED]
>    Palm OS ® certified developer
>
>    Please contact me, if you need an off-site contract worker.
> -------------------------------------------------------------------------
>



-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to