summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2023-09-23 18:46:24 +0200
committerGravatar default2023-09-23 18:46:24 +0200
commit291331c74557786cf5ef5b62a647048131f1394c (patch)
tree08e4f0cd8876181ed5a071842ab535b0f3243c20
parentIf a metadata starts with https:, convert it to a link. (diff)
downloadpenes-snac2-291331c74557786cf5ef5b62a647048131f1394c.tar.gz
penes-snac2-291331c74557786cf5ef5b62a647048131f1394c.tar.xz
penes-snac2-291331c74557786cf5ef5b62a647048131f1394c.zip
Backport from xs.
-rw-r--r--xs.h11
-rw-r--r--xs_version.h2
2 files changed, 7 insertions, 6 deletions
diff --git a/xs.h b/xs.h
index 40dd706..1fe210e 100644
--- a/xs.h
+++ b/xs.h
@@ -849,17 +849,18 @@ xs_str *xs_join(const xs_list *list, const char *sep)
849 int sz; 849 int sz;
850 850
851 /* add the separator */ 851 /* add the separator */
852 if (c != 0) { 852 if (c != 0 && ssz) {
853 s = xs_realloc(s, offset + ssz); 853 s = xs_realloc(s, offset + ssz);
854 memcpy(s + offset, sep, ssz); 854 memcpy(s + offset, sep, ssz);
855 offset += ssz; 855 offset += ssz;
856 } 856 }
857 857
858 /* add the element */ 858 /* add the element */
859 sz = strlen(v); 859 if ((sz = strlen(v)) > 0) {
860 s = xs_realloc(s, offset + sz); 860 s = xs_realloc(s, offset + sz);
861 memcpy(s + offset, v, sz); 861 memcpy(s + offset, v, sz);
862 offset += sz; 862 offset += sz;
863 }
863 864
864 c++; 865 c++;
865 } 866 }
diff --git a/xs_version.h b/xs_version.h
index 1873039..752e1be 100644
--- a/xs_version.h
+++ b/xs_version.h
@@ -1 +1 @@
/* 263e97c8ac21ff8524e3c890fe4310c696d01056 */ /* 89589de72ce632da77b0ac4b9d56d3902946b5eb */