mirror of
https://github.com/json-c/json-c.git
synced 2026-04-09 15:29:07 +08:00
compat/strdup.h: move common compat check for strdup() to own file
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
This commit is contained in:
@@ -23,6 +23,7 @@ endif()
|
|||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
|
||||||
|
|
||||||
set(JSON_C_HEADERS
|
set(JSON_C_HEADERS
|
||||||
|
./compat/strdup.h
|
||||||
./json.h
|
./json.h
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/include/config.h
|
${CMAKE_CURRENT_BINARY_DIR}/include/config.h
|
||||||
./json_config.h
|
./json_config.h
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ libjson_cincludedir = $(includedir)/json-c
|
|||||||
libjson_cinclude_HEADERS = \
|
libjson_cinclude_HEADERS = \
|
||||||
arraylist.h \
|
arraylist.h \
|
||||||
bits.h \
|
bits.h \
|
||||||
|
compat/strdup.h \
|
||||||
debug.h \
|
debug.h \
|
||||||
json.h \
|
json.h \
|
||||||
json_c_version.h \
|
json_c_version.h \
|
||||||
|
|||||||
13
compat/strdup.h
Normal file
13
compat/strdup.h
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#ifndef __STRDUP_H_COMPAT__
|
||||||
|
#define __STRDUP_H_COMPAT__
|
||||||
|
|
||||||
|
#include "../config.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 /* __STRDUP_H_COMPAT__ */
|
||||||
@@ -131,6 +131,9 @@ copy json_config.h.win32 json_config.h"/>
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\bits.h">
|
RelativePath=".\bits.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\compat\strdup.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\debug.h">
|
RelativePath=".\debug.h">
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ copy json_config.h.win32 json_config.h
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="arraylist.h" />
|
<ClInclude Include="arraylist.h" />
|
||||||
|
<ClInclude Include="compat\strdup.h" />
|
||||||
<ClInclude Include="debug.h" />
|
<ClInclude Include="debug.h" />
|
||||||
<ClInclude Include="json_inttypes.h" />
|
<ClInclude Include="json_inttypes.h" />
|
||||||
<ClInclude Include="json_object.h" />
|
<ClInclude Include="json_object.h" />
|
||||||
@@ -162,4 +163,4 @@ copy json_config.h.win32 json_config.h
|
|||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -47,6 +47,9 @@
|
|||||||
<ClInclude Include="arraylist.h">
|
<ClInclude Include="arraylist.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="compat\strdup.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="debug.h">
|
<ClInclude Include="debug.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -87,4 +90,4 @@
|
|||||||
<None Include="README-WIN32.html" />
|
<None Include="README-WIN32.html" />
|
||||||
<None Include="README.html" />
|
<None Include="README.html" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -29,13 +29,7 @@
|
|||||||
#include "json_object_private.h"
|
#include "json_object_private.h"
|
||||||
#include "json_util.h"
|
#include "json_util.h"
|
||||||
#include "math_compat.h"
|
#include "math_compat.h"
|
||||||
|
#include "compat/strdup.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 */
|
|
||||||
|
|
||||||
#if !defined(HAVE_SNPRINTF) && defined(_MSC_VER)
|
#if !defined(HAVE_SNPRINTF) && defined(_MSC_VER)
|
||||||
/* MSC has the version as _snprintf */
|
/* MSC has the version as _snprintf */
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include "json_object.h"
|
#include "json_object.h"
|
||||||
#include "json_tokener.h"
|
#include "json_tokener.h"
|
||||||
#include "json_util.h"
|
#include "json_util.h"
|
||||||
|
#include "compat/strdup.h"
|
||||||
|
|
||||||
#ifdef HAVE_LOCALE_H
|
#ifdef HAVE_LOCALE_H
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
@@ -41,13 +42,6 @@
|
|||||||
|
|
||||||
#define jt_hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x) & 7) + 9)
|
#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)
|
#if !HAVE_STRNCASECMP && defined(_MSC_VER)
|
||||||
/* MSC has the version as _strnicmp */
|
/* MSC has the version as _strnicmp */
|
||||||
# define strncasecmp _strnicmp
|
# define strncasecmp _strnicmp
|
||||||
|
|||||||
Reference in New Issue
Block a user