Browse Source

strdup_compat.h: re-spin this compat header ; use math_compat.h as template

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
tags/json-c-0.13-20171207
Alexandru Ardelean 9 years ago
parent
commit
8cb86a583a
8 changed files with 22 additions and 16 deletions
  1. +1
    -0
      CMakeLists.txt
  2. +1
    -0
      Makefile.am
  3. +2
    -1
      json-c.vcxproj
  4. +4
    -1
      json-c.vcxproj.filters
  5. +1
    -7
      json_object.c
  6. +1
    -0
      json_pointer.c
  7. +1
    -7
      json_tokener.c
  8. +11
    -0
      strdup_compat.h

+ 1
- 0
CMakeLists.txt View File

@@ -36,6 +36,7 @@ set(JSON_C_HEADERS
./json_util.h ./json_util.h
./linkhash.h ./linkhash.h
./math_compat.h ./math_compat.h
./strdup_compat.h
./printbuf.h ./printbuf.h
./random_seed.h ./random_seed.h
) )


+ 1
- 0
Makefile.am View File

@@ -32,6 +32,7 @@ libjson_cinclude_HEADERS = \
json_visit.h \ json_visit.h \
linkhash.h \ linkhash.h \
math_compat.h \ math_compat.h \
strdup_compat.h \
printbuf.h \ printbuf.h \
random_seed.h random_seed.h




+ 2
- 1
json-c.vcxproj View File

@@ -151,6 +151,7 @@ copy json_config.h.win32 json_config.h
<ClInclude Include="json_util.h" /> <ClInclude Include="json_util.h" />
<ClInclude Include="linkhash.h" /> <ClInclude Include="linkhash.h" />
<ClInclude Include="math_compat.h" /> <ClInclude Include="math_compat.h" />
<ClInclude Include="strdup_compat.h" />
<ClInclude Include="printbuf.h" /> <ClInclude Include="printbuf.h" />
<ClInclude Include="random_seed.h" /> <ClInclude Include="random_seed.h" />
</ItemGroup> </ItemGroup>
@@ -164,4 +165,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>

+ 4
- 1
json-c.vcxproj.filters View File

@@ -80,6 +80,9 @@
<ClInclude Include="math_compat.h"> <ClInclude Include="math_compat.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="strdup_compat.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="random_seed.h"> <ClInclude Include="random_seed.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
@@ -93,4 +96,4 @@
<None Include="README-WIN32.html" /> <None Include="README-WIN32.html" />
<None Include="README.html" /> <None Include="README.html" />
</ItemGroup> </ItemGroup>
</Project>
</Project>

+ 1
- 7
json_object.c View File

@@ -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"

#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) #if !defined(HAVE_SNPRINTF) && defined(_MSC_VER)
/* MSC has the version as _snprintf */ /* MSC has the version as _snprintf */


+ 1
- 0
json_pointer.c View File

@@ -16,6 +16,7 @@
#include <ctype.h> #include <ctype.h>


#include "json_pointer.h" #include "json_pointer.h"
#include "strdup_compat.h"


/** /**
* JavaScript Object Notation (JSON) Pointer * JavaScript Object Notation (JSON) Pointer


+ 1
- 7
json_tokener.c View File

@@ -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 "strdup_compat.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


+ 11
- 0
strdup_compat.h View File

@@ -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

Loading…
Cancel
Save