diff options
author | Joursoir <chat@joursoir.net> | 2021-05-19 08:46:07 +0000 |
---|---|---|
committer | Joursoir <chat@joursoir.net> | 2021-05-19 08:46:07 +0000 |
commit | 7cf1f7242a34f507c97a0bc50d951e48368c0212 (patch) | |
tree | ec2a496d724a955eb1fc7097fa07ef1d5096a7ec | |
parent | 949b3d31b6bab235b12ab269e309cf3d1fa7b61c (diff) | |
download | ctimeline-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
-rw-r--r-- | xstring.c | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -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)
|