diff options
| author | Tyge Løvset <[email protected]> | 2022-09-24 11:48:07 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-09-24 11:48:07 +0200 |
| commit | 756120e349a892ef1b7655fc777f28ec13845300 (patch) | |
| tree | 34d39e739f94ff52419ac431e1de26e1c431f2c0 /include/stc/forward.h | |
| parent | 26bc208248a0dd0f303d5b80bd298f5100b56e82 (diff) | |
| download | STC-modified-756120e349a892ef1b7655fc777f28ec13845300.tar.gz STC-modified-756120e349a892ef1b7655fc777f28ec13845300.zip | |
Fixes for csview and cstr sub-types (_value and _iter).
Diffstat (limited to 'include/stc/forward.h')
| -rw-r--r-- | include/stc/forward.h | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/include/stc/forward.h b/include/stc/forward.h index 167d1539..39628fa0 100644 --- a/include/stc/forward.h +++ b/include/stc/forward.h @@ -42,23 +42,27 @@ #define forward_cqueue(CX, VAL) _c_cdeq_types(CX, VAL) #define forward_cvec(CX, VAL) _c_cvec_types(CX, VAL) -typedef struct { char* data; size_t size, cap; } cstr_buf; +typedef const char csview_value; +typedef struct { csview_value* str; size_t size; } csview; +typedef union { + csview_value* ref; + struct { csview chr; csview_value* end; } u8; +} csview_iter; + typedef char cstr_value; +typedef struct { cstr_value* data; size_t size, cap; } cstr_buf; #if defined STC_CSTR_V1 - typedef struct { char* str; } cstr; + typedef struct { cstr_value* str; } cstr; #else typedef union { - struct { char data[sizeof(cstr_buf) - 1]; unsigned char last; } sml; - struct { char* data; size_t size, ncap; } lon; + struct { cstr_value data[sizeof(cstr_buf) - 1]; unsigned char last; } sml; + struct { cstr_value* data; size_t size, ncap; } lon; } cstr; #endif - -typedef struct { const char* str; size_t size; } csview; -typedef char csview_value; typedef union { - const char *ref; - struct { csview chr; const char *end; } u8; -} csview_iter, cstr_iter; + cstr_value* ref; + struct { csview chr; } u8; +} cstr_iter; #define c_true(...) __VA_ARGS__ #define c_false(...) |
