]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
strdup_compat.h: re-spin this compat header ; use math_compat.h as template
authorAlexandru Ardelean <ardeleanalex@gmail.com>
Wed, 16 Nov 2016 15:00:45 +0000 (17:00 +0200)
committerAlexandru Ardelean <ardeleanalex@gmail.com>
Tue, 22 Nov 2016 14:37:29 +0000 (16:37 +0200)
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
CMakeLists.txt
Makefile.am
json-c.vcxproj
json-c.vcxproj.filters
json_object.c
json_pointer.c
json_tokener.c
strdup_compat.h [new file with mode: 0644]

index 6dd38adcc6e93c5d49dfa8f3c2e80e21b53c4046..473e9b7c228d11e3fba101e50d2765b4167422fd 100644 (file)
@@ -36,6 +36,7 @@ set(JSON_C_HEADERS
     ./json_util.h
     ./linkhash.h
     ./math_compat.h
+    ./strdup_compat.h
     ./printbuf.h
     ./random_seed.h
 )
index 41b9e6e10bd64ea8f7e6a0d33512178cd92eb314..64b1a3dd34505e6eb9ade0ca3783d6fc65731cf4 100644 (file)
@@ -32,6 +32,7 @@ libjson_cinclude_HEADERS = \
        json_visit.h \
        linkhash.h \
        math_compat.h \
+       strdup_compat.h \
        printbuf.h \
        random_seed.h
 
index 8a4f265ea137989e2b8760e6650f8ba73965bb05..ab7b5e1f2a811d3fc46dbcdd9276327171f4ecab 100644 (file)
@@ -151,6 +151,7 @@ copy json_config.h.win32 json_config.h
     <ClInclude Include="json_util.h" />
     <ClInclude Include="linkhash.h" />
     <ClInclude Include="math_compat.h" />
+    <ClInclude Include="strdup_compat.h" />
     <ClInclude Include="printbuf.h" />
     <ClInclude Include="random_seed.h" />
   </ItemGroup>
@@ -164,4 +165,4 @@ copy json_config.h.win32 json_config.h
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
\ No newline at end of file
+</Project>
index 67ff360065a20f9b4a878cd6ca303e43b260c49e..3c6f43df7a80a1a2fbeaf350eb3cc061d0c45bb6 100644 (file)
@@ -80,6 +80,9 @@
     <ClInclude Include="math_compat.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="strdup_compat.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
     <ClInclude Include="random_seed.h">
       <Filter>Header Files</Filter>
     </ClInclude>
@@ -93,4 +96,4 @@
     <None Include="README-WIN32.html" />
     <None Include="README.html" />
   </ItemGroup>
-</Project>
\ No newline at end of file
+</Project>
index 8a70b5d28077ec5a21c6553bf72a76afa1a45950..c65941ea32f289b760987f46fd5fdc27be24e1f0 100644 (file)
 #include "json_object_private.h"
 #include "json_util.h"
 #include "math_compat.h"
-
-#if !defined(HAVE_STRDUP) && defined(_MSC_VER)
-  /* MSC has the version as _strdup */
-# define strdup _strdup
-#elif !defined(HAVE_STRDUP)
-# error You do not have strdup on your system.
-#endif /* HAVE_STRDUP */
+#include "strdup_compat.h"
 
 #if !defined(HAVE_SNPRINTF) && defined(_MSC_VER)
   /* MSC has the version as _snprintf */
index 582ca28dd9cd3163192b575bb2849b6ba12c516a..9cf3f160933d66ee042ece8cc250f0ff576ade0e 100644 (file)
@@ -16,6 +16,7 @@
 #include <ctype.h>
 
 #include "json_pointer.h"
+#include "strdup_compat.h"
 
 /**
  * JavaScript Object Notation (JSON) Pointer
index 65652f421fff3cca5cc23aa7a9fd25a43a40a6e0..6ddea11bf70f1a1a9e142e9f7f32c1637a6d6ae1 100644 (file)
@@ -31,6 +31,7 @@
 #include "json_object.h"
 #include "json_tokener.h"
 #include "json_util.h"
+#include "strdup_compat.h"
 
 #ifdef HAVE_LOCALE_H
 #include <locale.h>
 
 #define jt_hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x) & 7) + 9)
 
-#if !HAVE_STRDUP && defined(_MSC_VER)
-  /* MSC has the version as _strdup */
-# define strdup _strdup
-#elif !HAVE_STRDUP
-# error You do not have strdup on your system.
-#endif /* HAVE_STRDUP */
-
 #if !HAVE_STRNCASECMP && defined(_MSC_VER)
   /* MSC has the version as _strnicmp */
 # define strncasecmp _strnicmp
diff --git a/strdup_compat.h b/strdup_compat.h
new file mode 100644 (file)
index 0000000..51af81e
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef __strdup_compat_h
+#define __strdup_compat_h
+
+#if !defined(HAVE_STRDUP) && defined(_MSC_VER)
+  /* MSC has the version as _strdup */
+# define strdup _strdup
+#elif !defined(HAVE_STRDUP)
+# error You do not have strdup on your system.
+#endif /* HAVE_STRDUP */
+
+#endif