mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-15 01:55:03 +00:00
Backport from xs.
This commit is contained in:
parent
ac8790c3cd
commit
291331c745
2 changed files with 7 additions and 6 deletions
5
xs.h
5
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);
|
||||
if ((sz = strlen(v)) > 0) {
|
||||
s = xs_realloc(s, offset + sz);
|
||||
memcpy(s + offset, v, sz);
|
||||
offset += sz;
|
||||
}
|
||||
|
||||
c++;
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
/* 263e97c8ac21ff8524e3c890fe4310c696d01056 */
|
||||
/* 89589de72ce632da77b0ac4b9d56d3902946b5eb */
|
||||
|
|
Loading…
Reference in a new issue