rewrite sl_c_str as a function, will probably eventually do this for most pointless macros
This commit is contained in:
parent
28b948912e
commit
b4f6bafc82
1 changed files with 9 additions and 6 deletions
15
slibs.h
15
slibs.h
|
@ -141,12 +141,15 @@ typedef sl_vec(char) sl_string;
|
||||||
|
|
||||||
#define sl_str_free(str) sl_vec_free(str)
|
#define sl_str_free(str) sl_vec_free(str)
|
||||||
|
|
||||||
#define sl_c_str(str) \
|
const char* sl_c_str(sl_string str);
|
||||||
({ \
|
|
||||||
sl_vec_push((str), '\0'); \
|
#ifdef SL_IMPLEMENTATION
|
||||||
(str).size--; \
|
const char* sl_c_str(sl_string str) {
|
||||||
(str).data; \
|
sl_vec_push(str, '\0');
|
||||||
})
|
str.size--;
|
||||||
|
return str.data;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void sl_append_c_str(sl_string *sl_str, const char *c_str);
|
void sl_append_c_str(sl_string *sl_str, const char *c_str);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue