summaryrefslogtreecommitdiffstats
path: root/src/jplist.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2021-12-23 03:23:37 +0100
committerGravatar Nikias Bassen2021-12-23 03:23:37 +0100
commit6d7fc8add220885a8f5886bf76390bdb737ffbd9 (patch)
tree0bdafab9971cd9dcbfb599f1ba546f0f7fb37b54 /src/jplist.c
parent429cbc660ae14d4998715803b44c71abf0e4a339 (diff)
downloadlibplist-6d7fc8add220885a8f5886bf76390bdb737ffbd9.tar.gz
libplist-6d7fc8add220885a8f5886bf76390bdb737ffbd9.tar.bz2
jplist: Fix build on Windows
Diffstat (limited to 'src/jplist.c')
-rw-r--r--src/jplist.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/jplist.c b/src/jplist.c
index 08441c0..218d75a 100644
--- a/src/jplist.c
+++ b/src/jplist.c
@@ -65,6 +65,18 @@ void plist_json_deinit(void)
/* deinit JSON stuff */
}
+#ifndef HAVE_STRNDUP
+static char* strndup(char* str, size_t len)
+{
+ char *newstr = (char *)malloc(len+1);
+ if (newstr) {
+ strncpy(newstr, str, len);
+ newstr[len]= '\0';
+ }
+ return newstr;
+}
+#endif
+
static size_t dtostr(char *buf, size_t bufsize, double realval)
{
size_t len = 0;