TutBufAllocAligned allocate space in a T_BUF object
buf
T_BUF object in which to allocate the space
size
number of bytes to allocate
align
alignment factor
Pointer to the allocated memory block if successful, NULL
otherwise.
None
TutBufAllocAligned moves the "write pointer" in the T_BUF object to make space for a block of data. This block of data is to be copied into the buffer directly. The buffer grows, if required, to accommodate the space. The alignment factor is used to ensure that this new block ends on a valid boundary (say, 8 bytes), and the "write pointer" is rounded up so that the end of this block is aligned to this boundary.
Note that the returned pointer is valid only until the next call to a buffer operation that may resize the buffer, because the buffer may be moved during a resize.
This example allocates a block 10 bytes long that ends on an 8-byte boundary:
TIBCO SmartSockets™ Utilities Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |