Commit Graph

151 Commits

Author SHA1 Message Date
Petri Lehtinen
976fc2279f Replace all occurences of inline with JSON_INLINE
This makes it easier to compile without the configure script (e.g. on
Windows).
2010-09-05 21:18:46 +03:00
Petri Lehtinen
56643d4311 Merge branch '1.3'
Conflicts:
	doc/apiref.rst
	src/jansson_private.h
2010-08-14 21:02:08 +03:00
Petri Lehtinen
b76c69de1b Clarify and document the integer type configuration 2010-08-14 20:42:15 +03:00
Petri Lehtinen
bfac1972e2 Add a flags parameter to all decoding functions for future needs
As of now, the parameter is unused, but may be needed in the future.
I'm adding it now so that in the future both API and ABI remain
backwards compatible as long as possible.

This is a backwards incompatible change.
2010-08-14 17:28:09 +03:00
Petri Lehtinen
f8d0e01e46 Change the maximum indentation size to 32 spaces in encoder
This is to free up bits from the flags parameter of json_dump
functions. I'm pretty sure no-one needs 256 spaces of indentation when
pretty-printing JSON values...

This is a backwards incompatible change.
2010-08-13 22:12:36 +03:00
Petri Lehtinen
ffbab6fedd Change the underlying type of JSON integer from long to json_int_t
json_int_t is typedef'd to long long if it's supported, or long
otherwise. There's also some supporting things, like the
JSON_INTEGER_FORMAT macro that expands to the printf() conversion
specifier that corresponds to json_int_t's actual type.

This is a backwards incompatible change.
2010-08-13 22:07:20 +03:00
Petri Lehtinen
145032a57f Make object_key_t portable
A flexible array member is unportable. Use a table of length 1
instead. This needs some adjustment to the memory allocatio, too.
2010-08-12 21:35:23 +03:00
Petri Lehtinen
519d52e2bb Beautify the container_of macro
Use offsetof instead of zero pointer dereference trickery.
2010-08-12 21:34:51 +03:00
Petri Lehtinen
94182a5acc Replace inline with JSON_INLINE in json_object_iter_set() declaration 2010-08-12 21:10:12 +03:00
Petri Lehtinen
f71eb7fe17 Check for gcc before setting gcc specific CFLAGS 2010-08-12 21:00:09 +03:00
Petri Lehtinen
7ce70533c9 Move site configuration to jansson_config.h
This way, more site configuration can be more easily added later.
2010-08-10 22:16:55 +03:00
Petri Lehtinen
014c49c285 Change JSON integer's underlying type from int to long
This is a backwards incompatible change.
2010-08-10 21:45:18 +03:00
Petri Lehtinen
68f2861e92 Unify unsigned integer usage in the API
Replace all occurences of unsigned int and unsigned long with size_t.

This is a backwards incompatible change, as the signature of many API
functions changes.
2010-06-15 15:38:59 +03:00
Petri Lehtinen
2caac965d4 jansson 1.3 2010-06-13 20:37:33 +03:00
Petri Lehtinen
1347686dbf Remove the C++ interface 2010-06-12 22:45:49 +03:00
Petri Lehtinen
dec3ad498e Merge branch '1.2' 2010-05-20 18:47:30 +03:00
Petri Lehtinen
453e4c0aa2 Zero the visited flag after an encoding error
When encoding an array or object ends in an error, the visited flag
wasn't zeroed, causing subsequent encoding attempts to fail. This
patch fixes the problem by always zeroing the visited flag.
2010-05-14 09:23:35 +03:00
Petri Lehtinen
2630980f49 Zero the visited flag after encoding an empty array or object
Encoding an empty array or object worked, but encoding it again
(possibly after adding some items) failed, because the visited flag
(used for detecting circular references) wasn't zeroed.
2010-05-14 09:05:56 +03:00
Petri Lehtinen
782acfe378 Merge branch '1.2' 2010-05-07 07:36:01 +03:00
Petri Lehtinen
f9475f9577 load.c: Make stream_init() static 2010-05-07 07:35:11 +03:00
Petri Lehtinen
8857aeadfd Merge branch '1.2'
Conflicts:
	CHANGES
	configure.ac
	doc/conf.py
2010-04-03 14:00:59 +03:00
Petri Lehtinen
047a1417fb jansson 1.2.1 2010-04-03 13:49:56 +03:00
Petri Lehtinen
4e63fcd55d Merge branch '1.2'
Conflicts:
	configure.ac
2010-03-28 21:44:41 +03:00
Petri Lehtinen
29ee3832cf Support compilers that don't have the "inline" keyword
Use AC_C_INLINE autoconf macro, include config.h where needed, and add
a define of JSON_INLINE to jansson.h that has the correct "inline"
keyword.
2010-03-28 21:14:08 +03:00
Petri Lehtinen
bb89a5d4d3 Estimate real number underflows with 0.0
Earlier it was a decoding error.
2010-03-26 21:59:56 +02:00
Petri Lehtinen
49880cbabe Merge branch '1.2' 2010-03-23 08:15:19 +02:00
Petri Lehtinen
f284e3c069 Fix reference counting on true, false and null
Initialize their reference counts to (unsigned int)-1 to disable
reference counting on them. It already was meant to work like this,
but the reference counts were just initialized to 1 instead of -1.

Thanks to Andrew Thompson for reporting this issue.
2010-03-23 08:12:32 +02:00
Andres Freund
7d5982e6fe c++ wrapper: add missing 'inline' statements to various constructors
the missing 'inline' leads to duplicated symbols if the header is
included into two separately compiled files.
2010-03-18 14:35:09 +01:00
Petri Lehtinen
a2a9107600 Don't include stdint.h anywhere
This should have fixed by commit 28682322, but there was one #include
left in utf.c. It now includes utf.h instead of stdint.h.
2010-03-18 07:22:43 +02:00
Petri Lehtinen
42621370c3 hashtable: Fix typo in comment 2010-02-11 21:17:19 +02:00
Petri Lehtinen
8e61b7c0f0 Merge branch 'c++-enhance-proxies' 2010-02-11 21:06:19 +02:00
Petri Lehtinen
f18ef5144a Implement JSON_PRESERVE_ORDER encoding flag
With this encoding flag, the object key-value pairs in output are in
the same order in which they were first inserted into the object.

To make this possible, a key of an object is now a serial number plus
a string. An object keeps an increasing counter which is used to
assign serial number to the keys. Hashing, comparison and public API
functions were changed to act only on the string part, i.e. the serial
number is ignored everywhere else but in the encoder, where it's used
to order object keys if JSON_PRESERVE_ORDER flag is used.
2010-02-11 20:48:56 +02:00
Petri Lehtinen
307167fb66 Optimize hashtable_set()
If a key already exists in the hashtable, use the existing pair
changing its value instead of removing the old one and allocating a
new pair.
2010-02-09 20:51:25 +02:00
Petri Lehtinen
7e8b128740 C++: Optimize PropertyProxy
When the property already exists in the object, we can store an
iterator pointing to that property, instead of duplicating the key.

When the property (key) is not present in the object, we still have to
duplicate the key.
2010-02-08 20:51:09 +02:00
Petri Lehtinen
acec2559a5 C++: Make proxies safer
If a user happens to store an ElementProxy or a PropertyProxy
instance, we need to take a reference to the JSON value they point to.
With PropertyProxy, the key needs to be copied as well.
2010-02-07 14:08:54 +02:00
Petri Lehtinen
286823227c Make int32_t available on all systems
Use AC_TYPE_INT32_T and include inttypes.h (if it exists) instead of
stdint.h for maximum portability.
2010-02-06 21:11:41 +02:00
Petri Lehtinen
8d75235ff2 Merge branch '1.2'
Conflicts:
	LICENSE
2010-02-04 21:13:57 +02:00
Petri Lehtinen
adb1b58627 C++: Add Value::dump_file(), load_file() and loads() that take an std::string 2010-02-04 21:08:42 +02:00
Petri Lehtinen
b8059a1880 C++: Rename some functions to better match the C API
Value::save_file -> Value::dump_file
Value::save_string -> Value::dumps
load_string -> loads
2010-02-04 21:08:38 +02:00
Petri Lehtinen
49d40f020b C++: #include <cstdio> in jansson.hpp
This is to avoid standard C functions ending up in namespace json, as
jansson.h is #included in there, and jansson.h in turn #includes
stdio.h.
2010-02-04 20:50:02 +02:00
Petri Lehtinen
08dc8d9baf Add year 2010 to copyright notices 2010-02-02 21:26:11 +02:00
Petri Lehtinen
c9fc055351 Add myself as another copyright holder for jansson.hpp and jansson.ipp 2010-02-02 21:14:50 +02:00
Petri Lehtinen
d1a0c3ffc2 C++: Rename jansson-impl.hpp to jansson.ipp
The .ipp suffix is for inlined template implementation code.

While at it, use #ifdef and #ifndef instead of #if defined().
2010-02-02 21:10:58 +02:00
Petri Lehtinen
b07e69c37a C++: Rename namespace json::_private to json::detail 2010-02-02 21:01:50 +02:00
Petri Lehtinen
2b43e7dbda C++: Untabify, reindent, delete trailing whitespace 2010-02-02 21:00:10 +02:00
Petri Lehtinen
b495b96547 Add functions json_object_iter_{at,set,set_new} 2010-02-01 21:07:19 +02:00
Petri Lehtinen
3dd29366b8 Merge branch 'c++-api' 2010-01-21 22:29:26 +02:00
Petri Lehtinen
8c2ca3fae6 jansson 1.2 2010-01-21 21:49:10 +02:00
Sean Middleditch
38950b081c add meaningful copyright to jansson-impl.hpp too 2010-01-18 21:55:41 -08:00
Sean Middleditch
56687e9b56 add meaningful copyright to jansson.hpp 2010-01-18 21:55:25 -08:00