diff options
| author | 2026-08-25 19:25:56 -0400 | |
|---|---|---|
| committer | 2026-08-25 19:25:56 -0400 | |
| commit | 20f9d23538811dde9ce8aea051408a05e178b6d4 (patch) | |
| tree | d2afbc45345dad0d6c0a5456c4e6f2bc87d9202f /include/al/str.h | |
| parent | f6d6c613bf6d770a148e30afa4b94fd163e96d6a (diff) | |
| download | libalabaster-20f9d23538811dde9ce8aea051408a05e178b6d4.tar.gz libalabaster-20f9d23538811dde9ce8aea051408a05e178b6d4.tar.bz2 libalabaster-20f9d23538811dde9ce8aea051408a05e178b6d4.zip | |
str: al_str_null() -> AL_STR_EMPTY
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'include/al/str.h')
| -rw-r--r-- | include/al/str.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/al/str.h b/include/al/str.h index a572dec..e993cce 100644 --- a/include/al/str.h +++ b/include/al/str.h @@ -11,7 +11,7 @@ typedef struct { #define AL_STR_NO_POS ((u32)-1) -#define al_str_null() ((str){ 0, 0, NULL }) +#define AL_STR_EMPTY ((str){ 0, 0, NULL }) #define al_str_at(s, index) (s)->data[index] #define al_str_atr(s, index) (s)->data[(s)->length - (index)] @@ -43,7 +43,7 @@ static inline u32 al_str_reserve(str *s, u32 size) static inline void al_str_sized(str *s, u32 size) { - *s = al_str_null(); + *s = AL_STR_EMPTY; s->alloc = al_str_reserve(s, size); } @@ -88,6 +88,7 @@ static inline char *al_str_to_c_str(str *s) static inline void al_str_cat(str *s, str *c) { + al_assert(c->data && c->length > 0); s->alloc = al_str_reserve(s, s->length + c->length); al_memcpy(s->data + s->length, c->data, c->length); s->length += c->length; |