From 7cf1f7242a34f507c97a0bc50d951e48368c0212 Mon Sep 17 00:00:00 2001 From: Joursoir Date: Wed, 19 May 2021 08:46:07 +0000 Subject: ctimeline: make string_release() and string_reset() more simple * If we have string, then have char representation too --- xstring.c | 11 +++-------- 1 file 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) -- cgit v1.2.3-18-g5258