|
maug
Quick and dirty C mini-augmentation library.
|
Structure for storing a compact group of mutable, variable-length character strings. More...

Data Structures | |
| struct | MDATA_STRPOOL |
| A pool of immutable text strings. Deduplicates strings to save memory. More... | |
Macros | |
| #define | MDATA_STRPOOL_FLAG_IS_LOCKED 0x01 |
| #define | MDATA_STRPOOL_FLAG_DEDUPE 0x02 |
| #define | MDATA_STRPOOL_IDX_ERROR 0 |
| #define | mdata_strpool_ct(sp) |
| Get the number of strings in a strpool. | |
| #define | mdata_strpool_sz(sp) |
| Get the number of bytes allocated to a strpool. | |
| #define | mdata_strpool_is_locked(sp) |
| #define | mdata_strpool_lock(sp) |
| #define | mdata_strpool_unlock(sp) |
| #define | mdata_strpool_get(sp, idx) |
| Get a string by the index of its first character in the strpool. | |
| #define | mdata_strpool_get_sz(sp, idx) |
| Get the size of a string in a MDATA_STRPOOL. | |
| #define | mdata_strpool_get_len(sp, idx) |
| #define | mdata_strpool_padding(str_sz) |
Typedefs | |
| typedef size_t | mdata_strpool_idx_t |
Functions | |
| ssize_t | mdata_strpool_get_idx_from_linear (struct MDATA_STRPOOL *sp, size_t linear) |
| Get the native strpool index, given a linear index from 0 to mdata_strpool_ct(). | |
| MERROR_RETVAL | mdata_strpool_dump (struct MDATA_STRPOOL *sp) |
| MERROR_RETVAL | mdata_strpool_check_idx (struct MDATA_STRPOOL *sp, mdata_strpool_idx_t idx) |
| Verify if the given mdata_strpool_idx_t is valid in the given strpool. | |
| mdata_strpool_idx_t | mdata_strpool_find (struct MDATA_STRPOOL *sp, const char *str, size_t str_sz) |
| MAUG_MHANDLE | mdata_strpool_extract (struct MDATA_STRPOOL *sp, mdata_strpool_idx_t idx) |
| Return a dynamically-allocated memory handle containing the contents of the string at the given index. | |
| mdata_strpool_idx_t | mdata_strpool_append (struct MDATA_STRPOOL *sp, const char *str, size_t str_sz, uint8_t flags) |
| MERROR_RETVAL | mdata_strpool_remove (struct MDATA_STRPOOL *sp, mdata_strpool_idx_t idx) |
| MERROR_RETVAL | mdata_strpool_alloc (struct MDATA_STRPOOL *sp, size_t alloc_sz) |
| void | mdata_strpool_free (struct MDATA_STRPOOL *sp) |
Structure for storing a compact group of mutable, variable-length character strings.
| #define mdata_strpool_ct | ( | sp | ) |
Get the number of strings in a strpool.
| #define mdata_strpool_get | ( | sp, | |
| idx ) |
Get a string by the index of its first character in the strpool.
| #define mdata_strpool_get_len | ( | sp, | |
| idx ) |
| #define mdata_strpool_get_sz | ( | sp, | |
| idx ) |
Get the size of a string in a MDATA_STRPOOL.
| #define mdata_strpool_is_locked | ( | sp | ) |
| #define mdata_strpool_lock | ( | sp | ) |
| #define mdata_strpool_padding | ( | str_sz | ) |
| #define mdata_strpool_sz | ( | sp | ) |
Get the number of bytes allocated to a strpool.
| #define mdata_strpool_unlock | ( | sp | ) |
| ssize_t mdata_strpool_get_idx_from_linear | ( | struct MDATA_STRPOOL * | sp, |
| size_t | linear ) |
Get the native strpool index, given a linear index from 0 to mdata_strpool_ct().