From: Alexandru Ardelean Date: Wed, 16 Nov 2016 15:00:45 +0000 (+0200) Subject: strdup_compat.h: re-spin this compat header ; use math_compat.h as template X-Git-Tag: json-c-0.13-20171207~112^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8cb86a583afcb858d14b68216e3232f4e8f3962a;p=thirdparty%2Fjson-c.git strdup_compat.h: re-spin this compat header ; use math_compat.h as template Signed-off-by: Alexandru Ardelean --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 6dd38adc..473e9b7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,7 @@ set(JSON_C_HEADERS ./json_util.h ./linkhash.h ./math_compat.h + ./strdup_compat.h ./printbuf.h ./random_seed.h ) diff --git a/Makefile.am b/Makefile.am index 41b9e6e1..64b1a3dd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,6 +32,7 @@ libjson_cinclude_HEADERS = \ json_visit.h \ linkhash.h \ math_compat.h \ + strdup_compat.h \ printbuf.h \ random_seed.h diff --git a/json-c.vcxproj b/json-c.vcxproj index 8a4f265e..ab7b5e1f 100644 --- a/json-c.vcxproj +++ b/json-c.vcxproj @@ -151,6 +151,7 @@ copy json_config.h.win32 json_config.h + @@ -164,4 +165,4 @@ copy json_config.h.win32 json_config.h - \ No newline at end of file + diff --git a/json-c.vcxproj.filters b/json-c.vcxproj.filters index 67ff3600..3c6f43df 100644 --- a/json-c.vcxproj.filters +++ b/json-c.vcxproj.filters @@ -80,6 +80,9 @@ Header Files + + Header Files + Header Files @@ -93,4 +96,4 @@ - \ No newline at end of file + diff --git a/json_object.c b/json_object.c index 8a70b5d2..c65941ea 100644 --- a/json_object.c +++ b/json_object.c @@ -29,13 +29,7 @@ #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 */ diff --git a/json_pointer.c b/json_pointer.c index 582ca28d..9cf3f160 100644 --- a/json_pointer.c +++ b/json_pointer.c @@ -16,6 +16,7 @@ #include #include "json_pointer.h" +#include "strdup_compat.h" /** * JavaScript Object Notation (JSON) Pointer diff --git a/json_tokener.c b/json_tokener.c index 65652f42..6ddea11b 100644 --- a/json_tokener.c +++ b/json_tokener.c @@ -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 @@ -41,13 +42,6 @@ #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 index 00000000..51af81ec --- /dev/null +++ b/strdup_compat.h @@ -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