tibrvMsg_Expand()

Function

Declaration

tibrv_status tibrvMsg_Expand(
    tibrvMsg            message,
    tibrv_u32           additionalStorage);

Purpose

Enlarge a message by allocating additional storage.

Remarks

When adding data to a message would overflow the allocated space, the message automatically expands by allocating additional storage. However, reallocation (whether explicit or automatic) is a slow operation; to optimize program performance, we recommend allocating sufficient storage initially, so that reallocation is not required.

In most cases, the message expands in place (without copying). In some cases, this function copies the message to a new location. In all cases, existing pointers to the message, its fields, and its field values remain valid (even after copying).

If no space is available, this function returns the error code TIBRV_NO_MEMORY.

Parameter

Description

message

Expand this message.

additionalStorage

Enlarge the message by this amount (in bytes) to allocate for the message. If the message was oldSize bytes before this call, it is oldSize + additionalStorage when the function returns.