solidc
Robust collection of general-purpose cross-platform C libraries and data structures designed for rapid and safe development in C
Loading...
Searching...
No Matches
Public Attributes | List of all members
cstr Struct Reference

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]
 

Detailed Description

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.

Definition at line 104 of file cstr.h.

Member Data Documentation

◆ buf

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().

◆ capacity

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().

◆ data

char* cstr::data

◆ length

uint32_t cstr::length

The documentation for this struct was generated from the following file: