snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 291331c74557786cf5ef5b62a647048131f1394c
parent ac8790c3cd1dae815e276de000a5b31a437be7e8
Author: default <nobody@localhost>
Date:   Sat, 23 Sep 2023 18:46:24 +0200

Backport from xs.

Diffstat:
Mxs.h | 11++++++-----
Mxs_version.h | 2+-
2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/xs.h b/xs.h @@ -849,17 +849,18 @@ xs_str *xs_join(const xs_list *list, const char *sep) int sz; /* add the separator */ - if (c != 0) { + if (c != 0 && ssz) { s = xs_realloc(s, offset + ssz); memcpy(s + offset, sep, ssz); offset += ssz; } /* add the element */ - sz = strlen(v); - s = xs_realloc(s, offset + sz); - memcpy(s + offset, v, sz); - offset += sz; + if ((sz = strlen(v)) > 0) { + s = xs_realloc(s, offset + sz); + memcpy(s + offset, v, sz); + offset += sz; + } c++; } diff --git a/xs_version.h b/xs_version.h @@ -1 +1 @@ -/* 263e97c8ac21ff8524e3c890fe4310c696d01056 */ +/* 89589de72ce632da77b0ac4b9d56d3902946b5eb */