The variable length buffer package.
More...
The variable length buffer package.
◆ BU_VLB_NULL
#define BU_VLB_NULL ((struct bu_vlb *)0) |
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
#define BU_VLB_INIT |
( |
|
_vp | ) |
|
Value: { \
(_vp)->buf = NULL; \
(_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()
void bu_vlb_init |
( |
struct bu_vlb * |
vlb | ) |
|
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()
void bu_vlb_initialize |
( |
struct bu_vlb * |
vlb, |
|
|
size_t |
initialSize |
|
) |
| |
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()
void bu_vlb_write |
( |
struct bu_vlb * |
vlb, |
|
|
unsigned char * |
start, |
|
|
size_t |
len |
|
) |
| |
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()
void bu_vlb_reset |
( |
struct bu_vlb * |
vlb | ) |
|
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()
unsigned char * bu_vlb_addr |
( |
struct bu_vlb * |
vlb | ) |
|
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()
size_t bu_vlb_buflen |
( |
struct bu_vlb * |
vlb | ) |
|
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()
void bu_vlb_free |
( |
struct bu_vlb * |
vlb | ) |
|
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 |
|
) |
| |
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()
void bu_pr_vlb |
( |
const char * |
title, |
|
|
const struct bu_vlb * |
vlb |
|
) |
| |
Print the bytes set in a variable-length byte array.