The variable length buffer package.
More...
The variable length buffer package.
◆ BU_VLB_NULL
Definition at line 52 of file vlb.h.
◆ BU_CK_VLB
assert the integrity of a bu_vlb struct.
Definition at line 57 of file vlb.h.
◆ BU_VLB_INIT
Value: { \
(
_vp)->bufCapacity = (
_vp)->nextByte = 0; \
}
initializes a bu_vlb struct without allocating any memory.
Definition at line 62 of file vlb.h.
◆ BU_VLB_INIT_ZERO
macro suitable for declaration statement initialization of a bu_vlb struct. does not allocate memory.
Definition at line 72 of file vlb.h.
◆ BU_VLB_IS_INITIALIZED
◆ bu_vlb_t
Definition at line 51 of file vlb.h.
◆ bu_vlb_init()
Initialize the specified bu_vlb structure and mallocs the initial block of memory.
- Parameters
-
vlb | Pointer to an uninitialized bu_vlb structure |
◆ bu_vlb_initialize()
Initialize the specified bu_vlb structure and mallocs the initial block of memory with the specified size
- Parameters
-
vlb | Pointer to an uninitialized bu_vlb structure |
initialSize | The desired initial size of the buffer |
◆ bu_vlb_write()
Write some bytes to the end of the bu_vlb structure. If necessary, additional memory will be allocated.
- Parameters
-
vlb | Pointer to the bu_vlb structure to receive the bytes |
start | Pointer to the first byte to be copied to the bu_vlb structure |
len | The number of bytes to copy to the bu_vlb structure |
◆ bu_vlb_reset()
Reset the bu_vlb counter to the start of its byte array. This essentially ignores any bytes currently in the buffer, but does not free any memory.
- Parameters
-
vlb | Pointer to the bu_vlb structure to be reset |
◆ bu_vlb_addr()
Get a pointer to the byte array held by the bu_vlb structure
- Parameters
-
vlb | Pointer to the bu_vlb structure |
- Returns
- A pointer to the byte array contained by the bu_vlb structure
◆ bu_vlb_buflen()
Return the number of bytes used in the bu_vlb structure
- Parameters
-
vlb | Pointer to the bu_vlb structure |
- Returns
- The number of bytes written to the bu_vlb structure
◆ bu_vlb_free()
Free the memory allocated for the byte array in the bu_vlb structure. Also uninitializes the structure.
- Parameters
-
vlb | Pointer to the bu_vlb structure |
◆ bu_vlb_print()
void bu_vlb_print |
( |
struct bu_vlb * |
vlb, |
|
|
FILE * |
fd |
|
) |
| |
|
extern |
Write the current byte array from the bu_vlb structure to a file
- Parameters
-
vlb | Pointer to the bu_vlb structure that is the source of the bytes |
fd | Pointer to a FILE to receive the bytes |
◆ bu_pr_vlb()
Print the bytes set in a variable-length byte array.