Browse Source

Added json_stdbool.h following similar pattern to json_inttypes.h to provide <stdbool.h> support wherever it is missing.

pull/24/head
Mateusz Loskot 13 years ago
parent
commit
af5ae9903a
4 changed files with 38 additions and 4 deletions
  1. +2
    -0
      json_config.h.in
  2. +1
    -3
      json_object_iterator.c
  3. +2
    -1
      json_object_iterator.h
  4. +33
    -0
      json_stdbool.h

+ 2
- 0
json_config.h.in View File

@@ -1,3 +1,5 @@
/* Define to 1 if you have the <stdbool.h> header file. */
#undef JSON_C_HAVE_STDBOOL_H

/* Define to 1 if you have the <inttypes.h> header file. */
#undef JSON_C_HAVE_INTTYPES_H

+ 1
- 3
json_object_iterator.c View File

@@ -16,13 +16,11 @@
*/

#include <stddef.h>
#include <stdbool.h>

#include "json.h"
#include "json_object_private.h"

#include "json_object_iterator.h"
#include "json_stdbool.h"
/**
* How It Works
*


+ 2
- 1
json_object_iterator.h View File

@@ -29,7 +29,8 @@
#define JSON_OBJECT_ITERATOR_H

#include <stddef.h>
#include <stdbool.h>

#include "json_stdbool.h"

#ifdef __cplusplus
extern "C" {


+ 33
- 0
json_stdbool.h View File

@@ -0,0 +1,33 @@
#ifndef _json_stdbool_h_
#define _json_stdbool_h_

#include "json_config.h"

#ifndef __cplusplus
#if defined(_MSC_VER)

/* The C language implementation does not provide the standard header
* file "stdbool.h" as required by ISO/IEC 9899:1999.
*/
#if !defined(bool)
#define bool int
#endif

#if !defined(true)
#define true 1
#endif

#if !defined(false)
#define false 0
#endif

#else /* ndef _MSC_VER */

#ifdef JSON_C_HAVE_STDBOOL_H
#include <stdbool.h>
#endif

#endif /* _MSC_VER */
#endif /* __cplusplus */

#endif /* _json_stdbool_h_ */

Loading…
Cancel
Save