At 4:05 AM +0200 6/8/01, Terry Dennis wrote:
>Right ... but I don't have the actual pointer. All I have is an address of
>a location (actually a pointer to a string) somewhere within the chunk.
If you have a list of chunks, you could do a linear search by checking the address and
the size of each one. If (chunk addr <= ptr) and (chunk addr + chunk size >= ptr)
then the pointer is in that chunk.
Because of how the heaps are organized, there's no O(1) way of getting the chunk that
contains a given address. Linear search is pretty much the best you can do.
>This all came about because of 4.0's change to restrict tAIS usage to
>"system" type stuff. It used to be that I could use the address of the
>first tAIS entry to also be the address of the chunk. Can't do that with a
>tSTL, because they have that stupid prefix string in front of the first
>entry, as well as an int for the count of entries.
Invent your own resource format. It's easy. :-)
--Bob
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/