The mi_get_vardata_align() function
The mi_get_vardata_align() accessor function obtains a pointer to the data in a varying-length structure (such as mi_lvarchar) and adjusts for any initial padding required to align the data.
Syntax
char *mi_get_vardata_align(varlen_ptr, align)
mi_lvarchar *varlen_ptr,
mi_integer align;
- varlen_ptr
- A pointer to a variable-length structure.
- align
- The alignment boundary value.
Valid in client LIBMI application? | Valid in user-defined routine? |
---|---|
Yes | Yes |
Usage
The mi_get_vardata_align() function
aligns the data on the nearest align-byte boundary. The mi_get_vardata_align() function
is useful for data types whose alignment is not on a 4-byte boundary,
such as arrays that are stored in varying-length structures. Array
elements might have more stringent alignment requirements than the
4-byte alignment guaranteed by the varying-length structure. For opaque
data types, this value must match the align column of the sysxtdtypes system
catalog table.
Important: The varying-length structure
that “varlen_ptr” references is an opaque structure.
Do not access the fields of this structure directly. Instead, use mi_get_vardata_align() to
obtain the data from this structure in an aligned format.
The data in a varying-length structure is not null terminated. Do not use null termination to determine end of the data that the mi_get_vardata_align() returns. Instead, use the mi_get_varlen() function to obtain the actual data length, which you can then use to access the varying-length data.
Although the varlen_ptr argument is declared as a pointer to an mi_lvarchar, you can also use the mi_get_vardata_align() function to obtain aligned data from other varying-length data types, such as mi_sendrecv.
Return values
- A char pointer
- A pointer to the data in the varying-length structure.
- NULL
- The function was not successful.