Commit b47d3852 authored by Alessandro Ghedini's avatar Alessandro Ghedini

Imported Upstream version 2.4

parent 82c9fc85
Version 2.4
===========
Released 2012-09-23
* New features:
- Add `json_boolean()` macro that returns the JSON true or false
value based on its argument (#86).
- Add `json_load_callback()` that calls a callback function
repeatedly to read the JSON input (#57).
- Add JSON_ESCAPE_SLASH encoding flag to escape all occurences of
``/`` with ``\/``.
* Bug fixes:
- Check for and reject NaN and Inf values for reals. Encoding these
values resulted in invalid JSON.
- Fix `json_real_set()` to return -1 on error.
* Build:
- Jansson now builds on Windows with Visual Studio 2010, and
includes solution and project files in ``win32/vs2010/``
directory.
- Fix build warnings (#77, #78).
- Add ``-no-undefined`` to LDFLAGS (#90).
* Tests:
- Fix the symbol exports test on Linux/PPC64 (#88).
* Documentation:
- Fix typos (#73, #84).
Version 2.3.1
=============
......
EXTRA_DIST = CHANGES LICENSE README.rst
EXTRA_DIST = CHANGES LICENSE README.rst win32
SUBDIRS = doc src test
# "make distcheck" builds the dvi target, so use it to check that the
......
......@@ -251,7 +251,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
EXTRA_DIST = CHANGES LICENSE README.rst
EXTRA_DIST = CHANGES LICENSE README.rst win32
SUBDIRS = doc src test
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = jansson.pc
......
......@@ -33,8 +33,8 @@ To run the test suite, invoke::
$ make check
If the source has been checked out from a Git repository, the
./configure script has to be generated fist. The easiest way is to use
autoreconf::
./configure script has to be generated first. The easiest way is to
use autoreconf::
$ autoreconf -i
......
......@@ -8000,6 +8000,113 @@ _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
[0], [convert $build files to toolchain format])dnl
])# _LT_PATH_CONVERSION_FUNCTIONS
# longlong.m4 serial 14
dnl Copyright (C) 1999-2007, 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Paul Eggert.
# Define HAVE_LONG_LONG_INT if 'long long int' works.
# This fixes a bug in Autoconf 2.61, but can be removed once we
# assume 2.62 everywhere.
# Note: If the type 'long long int' exists but is only 32 bits large
# (as on some very old compilers), HAVE_LONG_LONG_INT will not be
# defined. In this case you can treat 'long long int' like 'long int'.
AC_DEFUN([AC_TYPE_LONG_LONG_INT],
[
AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
[AC_LINK_IFELSE(
[_AC_TYPE_LONG_LONG_SNIPPET],
[dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
dnl If cross compiling, assume the bug isn't important, since
dnl nobody cross compiles for this platform as far as we know.
AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[@%:@include <limits.h>
@%:@ifndef LLONG_MAX
@%:@ define HALF \
(1LL << (sizeof (long long int) * CHAR_BIT - 2))
@%:@ define LLONG_MAX (HALF - 1 + HALF)
@%:@endif]],
[[long long int n = 1;
int i;
for (i = 0; ; i++)
{
long long int m = n << i;
if (m >> i != n)
return 1;
if (LLONG_MAX / 2 < m)
break;
}
return 0;]])],
[ac_cv_type_long_long_int=yes],
[ac_cv_type_long_long_int=no],
[ac_cv_type_long_long_int=yes])],
[ac_cv_type_long_long_int=no])])
if test $ac_cv_type_long_long_int = yes; then
AC_DEFINE([HAVE_LONG_LONG_INT], [1],
[Define to 1 if the system has the type `long long int'.])
fi
])
# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
# This fixes a bug in Autoconf 2.61, but can be removed once we
# assume 2.62 everywhere.
# Note: If the type 'unsigned long long int' exists but is only 32 bits
# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
# will not be defined. In this case you can treat 'unsigned long long int'
# like 'unsigned long int'.
AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
[
AC_CACHE_CHECK([for unsigned long long int],
[ac_cv_type_unsigned_long_long_int],
[AC_LINK_IFELSE(
[_AC_TYPE_LONG_LONG_SNIPPET],
[ac_cv_type_unsigned_long_long_int=yes],
[ac_cv_type_unsigned_long_long_int=no])])
if test $ac_cv_type_unsigned_long_long_int = yes; then
AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1],
[Define to 1 if the system has the type `unsigned long long int'.])
fi
])
# Expands to a C program that can be used to test for simultaneous support
# of 'long long' and 'unsigned long long'. We don't want to say that
# 'long long' is available if 'unsigned long long' is not, or vice versa,
# because too many programs rely on the symmetry between signed and unsigned
# integer types (excluding 'bool').
AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
[
AC_LANG_PROGRAM(
[[/* For now, do not test the preprocessor; as of 2007 there are too many
implementations with broken preprocessors. Perhaps this can
be revisited in 2012. In the meantime, code should not expect
#if to work with literals wider than 32 bits. */
/* Test literals. */
long long int ll = 9223372036854775807ll;
long long int nll = -9223372036854775807LL;
unsigned long long int ull = 18446744073709551615ULL;
/* Test constant expressions. */
typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
? 1 : -1)];
typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
? 1 : -1)];
int i = 63;]],
[[/* Test availability of runtime routines for shift and division. */
long long int llmax = 9223372036854775807ll;
unsigned long long int ullmax = 18446744073709551615ull;
return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
| (llmax / ll) | (llmax % ll)
| (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
| (ullmax / ull) | (ullmax % ull));]])
])
# Helper functions for option handling. -*- Autoconf -*-
#
# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for jansson 2.3.1.
# Generated by GNU Autoconf 2.68 for jansson 2.4.
#
# Report bugs to <petri@digip.org>.
#
......@@ -570,8 +570,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='jansson'
PACKAGE_TARNAME='jansson'
PACKAGE_VERSION='2.3.1'
PACKAGE_STRING='jansson 2.3.1'
PACKAGE_VERSION='2.4'
PACKAGE_STRING='jansson 2.4'
PACKAGE_BUGREPORT='petri@digip.org'
PACKAGE_URL=''
......@@ -1292,7 +1292,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures jansson 2.3.1 to adapt to many kinds of systems.
\`configure' configures jansson 2.4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1362,7 +1362,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of jansson 2.3.1:";;
short | recursive ) echo "Configuration of jansson 2.4:";;
esac
cat <<\_ACEOF
......@@ -1463,7 +1463,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
jansson configure 2.3.1
jansson configure 2.4
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
......@@ -1906,7 +1906,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by jansson $as_me 2.3.1, which was
It was created by jansson $as_me 2.4, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
......@@ -2722,7 +2722,7 @@ fi
# Define the identity of the package.
PACKAGE='jansson'
VERSION='2.3.1'
VERSION='2.4'
cat >>confdefs.h <<_ACEOF
......@@ -11390,18 +11390,18 @@ else
/* end confdefs.h. */
/* For now, do not test the preprocessor; as of 2007 there are too many
implementations with broken preprocessors. Perhaps this can
be revisited in 2012. In the meantime, code should not expect
#if to work with literals wider than 32 bits. */
implementations with broken preprocessors. Perhaps this can
be revisited in 2012. In the meantime, code should not expect
#if to work with literals wider than 32 bits. */
/* Test literals. */
long long int ll = 9223372036854775807ll;
long long int nll = -9223372036854775807LL;
unsigned long long int ull = 18446744073709551615ULL;
/* Test constant expressions. */
typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
? 1 : -1)];
? 1 : -1)];
typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
? 1 : -1)];
? 1 : -1)];
int i = 63;
int
main ()
......@@ -11410,40 +11410,40 @@ main ()
long long int llmax = 9223372036854775807ll;
unsigned long long int ullmax = 18446744073709551615ull;
return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
| (llmax / ll) | (llmax % ll)
| (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
| (ullmax / ull) | (ullmax % ull));
| (llmax / ll) | (llmax % ll)
| (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
| (ullmax / ull) | (ullmax % ull));
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
if test "$cross_compiling" = yes; then :
if test "$cross_compiling" = yes; then :
ac_cv_type_long_long_int=yes
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <limits.h>
#ifndef LLONG_MAX
# define HALF \
(1LL << (sizeof (long long int) * CHAR_BIT - 2))
# define LLONG_MAX (HALF - 1 + HALF)
#endif
#ifndef LLONG_MAX
# define HALF \
(1LL << (sizeof (long long int) * CHAR_BIT - 2))
# define LLONG_MAX (HALF - 1 + HALF)
#endif
int
main ()
{
long long int n = 1;
int i;
for (i = 0; ; i++)
{
long long int m = n << i;
if (m >> i != n)
return 1;
if (LLONG_MAX / 2 < m)
break;
}
return 0;
int i;
for (i = 0; ; i++)
{
long long int m = n << i;
if (m >> i != n)
return 1;
if (LLONG_MAX / 2 < m)
break;
}
return 0;
;
return 0;
}
......@@ -12087,7 +12087,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by jansson $as_me 2.3.1, which was
This file was extended by jansson $as_me 2.4, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -12153,7 +12153,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
jansson config.status 2.3.1
jansson config.status 2.4
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
......
AC_PREREQ([2.60])
AC_INIT([jansson], [2.3.1], [petri@digip.org])
AC_INIT([jansson], [2.4], [petri@digip.org])
AM_INIT_AUTOMAKE([1.10 foreign])
......
......@@ -255,8 +255,8 @@ returns an error status.
True, False and Null
====================
These values are implemented as singletons, so each of these functions
returns the same value each time.
These three values are implemented as singletons, so the returned
pointers won't change between invocations of these functions.
.. function:: json_t *json_true(void)
......@@ -270,6 +270,17 @@ returns the same value each time.
Returns the JSON false value.
.. function:: json_t *json_boolean(val)
.. refcounting:: new
Returns JSON false if ``val`` is zero, and JSON true otherwise.
This is a macro, and equivalent to ``val ? json_true() :
json_false()``.
.. versionadded:: 2.4
.. function:: json_t *json_null(void)
.. refcounting:: new
......@@ -798,6 +809,11 @@ can be ORed together to obtain *flags*.
.. versionadded:: 2.1
``JSON_ESCAPE_SLASH``
Escape the ``/`` characters in strings with ``\/``.
.. versionadded:: 2.4
The following functions perform the actual JSON encoding. The result
is in UTF-8.
......@@ -967,6 +983,34 @@ The following functions perform the actual JSON decoding.
filled with information about the error. *flags* is described
above.
.. type:: json_load_callback_t
A typedef for a function that's called by
:func:`json_load_callback()` to read a chunk of input data::
typedef size_t (*json_load_callback_t)(void *buffer, size_t buflen, void *data);
*buffer* points to a buffer of *buflen* bytes, and *data* is the
corresponding :func:`json_load_callback()` argument passed through.
On error, the function should return ``(size_t)-1`` to abort the
decoding process. When there's no data left, it should return 0 to
report that the end of input has been reached.
.. versionadded:: 2.4
.. function:: json_t *json_load_callback(json_load_callback_t callback, void *data, size_t flags, json_error_t *error)
.. refcounting:: new
Decodes the JSON text produced by repeated calls to *callback*, and
returns the array or object it contains, or *NULL* on error, in
which case *error* is filled with information about the error.
*data* is passed through to *callback* on each call. *flags* is
described above.
.. versionadded:: 2.4
.. _apiref-pack:
......@@ -1073,7 +1117,7 @@ More examples::
json_pack("{s:i, s:i}", "foo", 42, "bar", 7);
/* Build the JSON array [[1, 2], {"cool": true}] */
json_pack("[[i,i],{s:b]]", 1, 2, "cool", 1);
json_pack("[[i,i],{s:b}]", 1, 2, "cool", 1);
.. _apiref-unpack:
......@@ -1191,7 +1235,7 @@ The following functions compose the parsing and validation API:
modifying the structure or contents of a value reachable from
``root``.
If the ``O`` and ``o`` format character are not used, it's
If the ``O`` and ``o`` format characters are not used, it's
perfectly safe to cast a ``const json_t *`` variable to plain
``json_t *`` when used with these functions.
......
......@@ -48,7 +48,7 @@ copyright = u'2009-2012, Petri Lehtinen'
# built documents.
#
# The short X.Y version.
version = '2.3.1'
version = '2.4'
# The full version, including alpha/beta/rc tags.
release = version
......
......@@ -54,22 +54,25 @@ used as described above.
.. _libtool: http://www.gnu.org/software/libtool/
Windows
-------
Jansson can be built with Visual Studio 2010 (and probably newer
versions, too). The solution and project files are in the
``win32/vs2010/`` directory in the source distribution.
Other Systems
-------------
On Windows and other non Unix-like systems, you may be unable to run
the ``./configure`` script. In this case, follow these steps. All the
files mentioned can be found in the ``src/`` directory.
On non Unix-like systems, you may be unable to run the ``./configure``
script. In this case, follow these steps. All the files mentioned can
be found in the ``src/`` directory.
1. Create ``jansson_config.h``. This file has some platform-specific
1. Create ``jansson_config.h`` (which has some platform-specific
parameters that are normally filled in by the ``./configure``
script:
- On Windows, rename ``jansson_config.h.win32`` to ``jansson_config.h``.
- On other systems, edit ``jansson_config.h.in``, replacing all
``@variable@`` placeholders, and rename the file to
``jansson_config.h``.
script). Edit ``jansson_config.h.in``, replacing all ``@variable@``
placeholders, and rename the file to ``jansson_config.h``.
2. Make ``jansson.h`` and ``jansson_config.h`` available to the
compiler, so that they can be found when compiling programs that
......
......@@ -205,7 +205,7 @@ Next we'll extract the commit ID (a hexadecimal SHA-1 sum),
intermediate commit info object, and the commit message from that
object. We also do proper type checks::
sha = json_object_get(commit, "sha");
sha = json_object_get(data, "sha");
if(!json_is_string(sha))
{
fprintf(stderr, "error: commit %d: sha is not a string\n", i + 1);
......
......@@ -70,7 +70,7 @@
# compiler: $LTCC
# compiler flags: $LTCFLAGS
# linker: $LD (gnu? $with_gnu_ld)
# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1
# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1
# automake: $automake_version
# autoconf: $autoconf_version
#
......@@ -80,7 +80,7 @@
PROGRAM=libtool
PACKAGE=libtool
VERSION="2.4.2 Debian-2.4.2-1"
VERSION="2.4.2 Debian-2.4.2-1ubuntu1"
TIMESTAMP=""
package_revision=1.3337
......
EXTRA_DIST = jansson_config.h.win32
EXTRA_DIST = jansson.def
include_HEADERS = jansson.h jansson_config.h
......@@ -19,8 +19,9 @@ libjansson_la_SOURCES = \
utf.h \
value.c
libjansson_la_LDFLAGS = \
-no-undefined \
-export-symbols-regex '^json_' \
-version-info 7:1:3
-version-info 8:0:4
if GCC
# These flags are gcc specific
......
......@@ -218,7 +218,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
EXTRA_DIST = jansson_config.h.win32
EXTRA_DIST = jansson.def
include_HEADERS = jansson.h jansson_config.h
lib_LTLIBRARIES = libjansson.la
libjansson_la_SOURCES = \
......@@ -238,8 +238,9 @@ libjansson_la_SOURCES = \
value.c
libjansson_la_LDFLAGS = \
-no-undefined \
-export-symbols-regex '^json_' \
-version-info 7:1:3
-version-info 8:0:4
# These flags are gcc specific
......
......@@ -11,7 +11,7 @@
#include <string.h>
#include <assert.h>
#include <jansson.h>
#include "jansson.h"
#include "jansson_private.h"
#include "strbuffer.h"
#include "utf.h"
......@@ -62,7 +62,7 @@ static int dump_indent(size_t flags, int depth, int space, json_dump_callback_t
return 0;
}
static int dump_string(const char *str, int ascii, json_dump_callback_t dump, void *data)
static int dump_string(const char *str, json_dump_callback_t dump, void *data, size_t flags)
{
const char *pos, *end;
int32_t codepoint;
......@@ -87,8 +87,12 @@ static int dump_string(const char *str, int ascii, json_dump_callback_t dump, vo
if(codepoint == '\\' || codepoint == '"' || codepoint < 0x20)
break;
/* slash */
if((flags & JSON_ESCAPE_SLASH) && codepoint == '/')
break;
/* non-ASCII */
if(ascii && codepoint > 0x7F)
if((flags & JSON_ENSURE_ASCII) && codepoint > 0x7F)
break;
pos = end;
......@@ -102,7 +106,7 @@ static int dump_string(const char *str, int ascii, json_dump_callback_t dump, vo
if(end == pos)
break;
/* handle \, ", and control codes */
/* handle \, /, ", and control codes */
length = 2;
switch(codepoint)
{
......@@ -113,6 +117,7 @@ static int dump_string(const char *str, int ascii, json_dump_callback_t dump, vo
case '\n': text = "\\n"; break;
case '\r': text = "\\r"; break;
case '\t': text = "\\t"; break;
case '/': text = "\\/"; break;
default:
{
/* codepoint is in BMP */
......@@ -166,8 +171,6 @@ static int object_key_compare_serials(const void *key1, const void *key2)
static int do_dump(const json_t *json, size_t flags, int depth,
json_dump_callback_t dump, void *data)
{
int ascii = flags & JSON_ENSURE_ASCII ? 1 : 0;
switch(json_typeof(json)) {
case JSON_NULL:
return dump("null", 4, data);
......@@ -186,7 +189,7 @@ static int do_dump(const json_t *json, size_t flags, int depth,
size = snprintf(buffer, MAX_INTEGER_STR_LENGTH,
"%" JSON_INTEGER_FORMAT,
json_integer_value(json));
if(size >= MAX_INTEGER_STR_LENGTH)
if(size < 0 || size >= MAX_INTEGER_STR_LENGTH)
return -1;
return dump(buffer, size, data);
......@@ -206,7 +209,7 @@ static int do_dump(const json_t *json, size_t flags, int depth,
}
case JSON_STRING:
return dump_string(json_string_value(json), ascii, dump, data);
return dump_string(json_string_value(json), dump, data, flags);
case JSON_ARRAY:
{
......@@ -327,7 +330,7 @@ static int do_dump(const json_t *json, size_t flags, int depth,
value = json_object_get(json, key);
assert(value);
dump_string(key, ascii, dump, data);
dump_string(key, dump, data, flags);
if(dump(separator, separator_length, data) ||
do_dump(value, flags, depth + 1, dump, data))
{
......@@ -364,7 +367,7 @@ static int do_dump(const json_t *json, size_t flags, int depth,
{
void *next = json_object_iter_next((json_t *)json, iter);
dump_string(json_object_iter_key(iter), ascii, dump, data);
dump_string(json_object_iter_key(iter), dump, data, flags);
if(dump(separator, separator_length, data) ||
do_dump(json_object_iter_value(iter), flags, depth + 1,
dump, data))
......
......@@ -59,4 +59,5 @@ void jsonp_error_vset(json_error_t *error, int line, int column,
error->position = position;
vsnprintf(error->text, JSON_ERROR_TEXT_LENGTH, msg, ap);
error->text[JSON_ERROR_TEXT_LENGTH - 1] = '\0';
}
LIBRARY "jansson"
EXPORTS
json_delete
json_true
json_false
json_null
json_string
json_string_nocheck
json_string_value
json_string_set
json_string_set_nocheck
json_integer
json_integer_value
json_integer_set
json_real
json_real_value
json_real_set
json_number_value
json_array
json_array_size
json_array_get
json_array_set_new
json_array_append_new
json_array_insert_new
json_array_remove
json_array_clear
json_array_extend
json_object
json_object_size
json_object_get
json_object_set_new
json_object_set_new_nocheck
json_object_del
json_object_clear
json_object_update
json_object_update_existing
json_object_update_missing
json_object_iter
json_object_iter_at
json_object_iter_next
json_object_iter_key
json_object_iter_value
json_object_iter_set_new
json_object_key_to_iter
json_dumps
json_dumpf
json_dump_file
json_dump_callback
json_loads
json_loadb
json_loadf
json_load_file
json_load_callback
json_equal
json_copy
json_deep_copy
json_pack
json_pack_ex
json_vpack_ex
json_unpack
json_unpack_ex
json_vunpack_ex
json_set_alloc_funcs
......@@ -21,11 +21,11 @@ extern "C" {
/* version */
#define JANSSON_MAJOR_VERSION 2
#define JANSSON_MINOR_VERSION 3
#define JANSSON_MICRO_VERSION 1
#define JANSSON_MINOR_VERSION 4
#define JANSSON_MICRO_VERSION 0
/* Micro version is omitted if it's 0 */
#define JANSSON_VERSION "2.3.1"
#define JANSSON_VERSION "2.4"
/* Version as a 3-byte hex number, e.g. 0x010201 == 1.2.1. Use this
for numeric comparisons, e.g. #if JANSSON_VERSION_HEX >= ... */
......@@ -86,6 +86,7 @@ json_t *json_integer(json_int_t value);
json_t *json_real(double value);
json_t *json_true(void);
json_t *json_false(void);
#define json_boolean(val) ((val) ? json_true() : json_false())
json_t *json_null(void);
static JSON_INLINE
......@@ -232,10 +233,13 @@ json_t *json_deep_copy(json_t *value);
#define JSON_DISABLE_EOF_CHECK 0x2
#define JSON_DECODE_ANY 0x4
typedef size_t (*json_load_callback_t)(void *buffer, size_t buflen, void *data);
json_t *json_loads(const char *input, size_t flags, json_error_t *error);
json_t *json_loadb(const char *buffer, size_t buflen, size_t flags, json_error_t *error);
json_t *json_loadf(FILE *input, size_t flags, json_error_t *error);
json_t *json_load_file(const char *path, size_t flags, json_error_t *error);
json_t *json_load_callback(json_load_callback_t callback, void *data, size_t flags, json_error_t *error);
/* encoding */
......@@ -246,6 +250,7 @@ json_t *json_load_file(const char *path, size_t flags, json_error_t *error);
#define JSON_SORT_KEYS 0x80
#define JSON_PRESERVE_ORDER 0x100
#define JSON_ENCODE_ANY 0x200
#define JSON_ESCAPE_SLASH 0x400
typedef int (*json_dump_callback_t)(const char *buffer, size_t size, void *data);
......
......@@ -83,4 +83,10 @@ void* jsonp_malloc(size_t size);
void jsonp_free(void