diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/stc/alt/cstr.h | 3 | ||||
| -rw-r--r-- | include/stc/cstr.h | 4 | ||||
| -rw-r--r-- | include/stc/forward.h | 12 |
3 files changed, 6 insertions, 13 deletions
diff --git a/include/stc/alt/cstr.h b/include/stc/alt/cstr.h index 728ce77f..ba0eb0bb 100644 --- a/include/stc/alt/cstr.h +++ b/include/stc/alt/cstr.h @@ -22,7 +22,6 @@ */ #ifndef CSTR_H_INCLUDED #define CSTR_H_INCLUDED -#define STC_CSTR_V1 1 #include <stc/ccommon.h> #include <stc/forward.h> @@ -32,6 +31,8 @@ #include <stdio.h> /* vsnprintf */ #include <ctype.h> +typedef char cstr_value; +typedef struct { cstr_value* str; } cstr; #define cstr_npos (SIZE_MAX >> 1) typedef struct { size_t size, cap; char chr[1]; } cstr_priv; #define _cstr_p(self) c_unchecked_container_of((self)->str, cstr_priv, chr) diff --git a/include/stc/cstr.h b/include/stc/cstr.h index ec5cd3c9..bf58444c 100644 --- a/include/stc/cstr.h +++ b/include/stc/cstr.h @@ -24,9 +24,6 @@ /* A string type with short string optimization in C99 with good small-string * optimization (22 characters with 24 bytes string). */ -#ifdef STC_CSTR_V1 -#include "alt/cstr.h" -#else #ifndef CSTR_H_INCLUDED #define CSTR_H_INCLUDED @@ -631,4 +628,3 @@ STC_DEF size_t cstr_printf(cstr* self, const char* fmt, ...) { #undef i_static #undef i_implement #undef i_extern -#endif // !STC_CSTR_V1 diff --git a/include/stc/forward.h b/include/stc/forward.h index a45efc3c..45a68e3a 100644 --- a/include/stc/forward.h +++ b/include/stc/forward.h @@ -51,14 +51,10 @@ typedef union { typedef char cstr_value; typedef struct { cstr_value* data; size_t size, cap; } cstr_buf; -#if defined STC_CSTR_V1 - typedef struct { cstr_value* str; } cstr; -#else - typedef union { - struct { cstr_value data[sizeof(cstr_buf) - 1]; unsigned char size; } sml; - struct { cstr_value* data; size_t size, ncap; } lon; - } cstr; -#endif +typedef union { + struct { cstr_value data[sizeof(cstr_buf) - 1]; unsigned char size; } sml; + struct { cstr_value* data; size_t size, ncap; } lon; +} cstr; typedef union { cstr_value* ref; struct { csview chr; } u8; |
