|
solidc
Robust collection of general-purpose cross-platform C libraries and data structures designed for rapid and safe development in C
|
A dynamically resizable C string with SSO. More...
#include <cstr.h>
Public Attributes | |
| char * | data |
| uint32_t | length |
| uint32_t | capacity |
| char | buf [CSTR_SSO_CAP] |
A dynamically resizable C string with SSO.
data is ALWAYS a valid, NUL-terminated pointer:
This eliminates the branch in every read — callers just dereference data.
| char cstr::buf[CSTR_SSO_CAP] |
Inline buffer (active when !heap flag)
Definition at line 108 of file cstr.h.
Referenced by cstr_init_inplace().
| uint32_t cstr::capacity |
Heap cap (MSB=heap flag) OR SSO sentinel
Definition at line 107 of file cstr.h.
Referenced by cstr_heap_cap(), cstr_init_inplace(), cstr_is_heap(), and cstr_shrink_to_fit().
| char* cstr::data |
Always-valid pointer to string bytes + NUL
Definition at line 105 of file cstr.h.
Referenced by cstr_append_char(), cstr_append_fast(), cstr_as_view(), cstr_at(), cstr_clear(), cstr_cmp(), cstr_data(), cstr_data_const(), cstr_debug(), cstr_drop(), cstr_free(), cstr_init_inplace(), cstr_join(), cstr_new_len(), cstr_remove(), cstr_remove_char(), cstr_remove_substr(), and cstr_shrink_to_fit().
| uint32_t cstr::length |
Current string length (excluding NUL)
Definition at line 106 of file cstr.h.
Referenced by cstr_append_char(), cstr_append_fast(), cstr_as_view(), cstr_at(), cstr_clear(), cstr_debug(), cstr_empty(), cstr_init_inplace(), cstr_join(), cstr_len(), cstr_new_len(), cstr_remove(), cstr_remove_char(), cstr_remove_substr(), and cstr_shrink_to_fit().