summaryrefslogtreecommitdiff
path: root/include/al/str.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/al/str.h')
-rw-r--r--include/al/str.h5
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;