void ChunkArrayDelete(
optr array, /* optr to chunk array */
void * element); /* Address of element to delete */
This routine deletes an element from a chunk array. It is passed the address of that element, as well as the optr of the array.
Since the chunk is being decreased in size, the routine is guaranteed not to cause heap compaction or resizing.
Include: chunkarr.h
Be Sure To: Lock the LMem heap's block on the global heap (unless it is fixed).
Tips and Tricks: Only the chunk handle portion of the optr is significant; the memory block is determined from the pointer to the element.
Warnings: The addresses of all elements after the deleted one will change. No other addresses in the block will be affected. If the address passed is not the address of an element in the array, results are undefined.
See Also: ChunkArrayAppend(),
ChunkArrayInsertAt(),
ChunkArrayZero().
void ChunkArrayDeleteHandle(
ChunkHandle ch, /* Handle of chunk array */
void * el); /* Address of element to delete */
This routine is exactly like
ChunkArrayDelete()
, except that the chunk array is specified with its chunk handle instead of with an optr. The global memory handle is not needed, as the memory block is implicit in the pointer to the element.
Be Sure To: Lock the LMem heap's block on the global heap (unless it is fixed).
Include: chunkarr.h
void ChunkArrayDeleteRange(
optr array, /* optr to chunk array */
word firstElement, /* index of first element to delete */
word count); /* # of elements to delete (-1 to delete to
* end of array) */
This routine deletes several consecutive elements from a chunk array. The routine is passed the optr of the chunk array, the index of the first element to delete, and the number of elements to delete. The routine is guaranteed not to cause heap compaction or resizing; thus, pointers to other elements in the array will remain valid.
void ChunkArrayElementResize(
optr array, /* optr to chunk array */
word element, /* Index of element to resize */
word newSize); /* New size of element, in bytes */
This routine resizes an element in a chunk array. The chunk array must have variable-sized elements. The routine is passed an optr to the chunk array (which must be locked on the global heap), as well as the index of the element to resize and the new size (in bytes). It does not return anything.
If the new size is larger than the old, null bytes will be added to the end of the element. If the new size is smaller than the old, bytes will be removed from the end to truncate the element to the new size.
Warnings: If the element is resized larger, the chunk array may move within the LMem heap, and the heap itself may move on the global heap; thus, all pointers to within the LMem heap will be invalidated.
Be Sure To: Lock the LMem heap's block on the global heap (unless it is fixed).
Include: chunkarr.h
void ChunkArrayElementResizeHandles(
Memhandle mh, /* Global handle of LMem heap */
ChunkHandle ch, /* Chunk handle of chunk array */
word el, /* Index of element to resize */
word ns); /* New size of element, in bytes */
This routine is exactly like
ChunkArrayElementResize()
except that the chunk array is specified with its global and chunk handles, instead of with its optr.
Warnings: If the element is resized to larger than the old, the chunk array may move within the LMem heap, and the heap itself may move on the global heap; thus, all pointers to within the LMem heap will be invalidated.
Be Sure To: Lock the LMem heap's block on the global heap (unless it is fixed).
Include: chunkarr.h
GEOS SDK TechDocs
|
|
CFatalError() ...
|
ChunkArrayElementToPtr() ...