aboutsummaryrefslogtreecommitdiffstats
path: root/xstring.c
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-05-19 08:46:07 +0000
committerJoursoir <chat@joursoir.net>2021-05-19 08:46:07 +0000
commit7cf1f7242a34f507c97a0bc50d951e48368c0212 (patch)
treeec2a496d724a955eb1fc7097fa07ef1d5096a7ec /xstring.c
parent949b3d31b6bab235b12ab269e309cf3d1fa7b61c (diff)
downloadctimeline-7cf1f7242a34f507c97a0bc50d951e48368c0212.tar.gz
ctimeline-7cf1f7242a34f507c97a0bc50d951e48368c0212.tar.bz2
ctimeline-7cf1f7242a34f507c97a0bc50d951e48368c0212.zip
ctimeline: make string_release() and string_reset() more simple
* If we have string, then have char representation too
Diffstat (limited to 'xstring.c')
-rw-r--r--xstring.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/xstring.c b/xstring.c
index 09c6bf3..7dcb5f1 100644
--- a/xstring.c
+++ b/xstring.c
@@ -38,19 +38,14 @@ string *string_nalloc(string *str, const char *text, size_t text_len)
void string_release(string *str)
{
- if(str->s) {
- free(str->s);
- str->s = NULL;
- }
+ free(str->s);
free(str);
}
void string_reset(string *str)
{
- if(str->s) {
- str->s[0] = '\0';
- str->len = 0;
- }
+ str->s[0] = '\0';
+ str->len = 0;
}
static void string_realloc(string *str, int cap)