Commit Graph

92 Commits

Author SHA1 Message Date
Petri Lehtinen
cbacac5975 Extend array API
Added functions:

  json_array_insert
  json_array_insert_new
  json_array_remove
  json_array_clear
  json_array_extend
2009-09-29 22:17:58 +03:00
Petri Lehtinen
b3e1fe2ec5 doc: Add getting started guide 2009-09-20 21:56:12 +03:00
Petri Lehtinen
7728716759 Merge branch '1.0'
Conflicts:
	configure.ac
	doc/conf.py
2009-09-14 15:06:06 +03:00
Petri Lehtinen
b7bf96996f jansson 1.0.3 2009-09-14 14:32:41 +03:00
Petri Lehtinen
6d8c287032 load: Check for integer and real overlfows and underflows
Backported from master, commit 5406c2b3d3:
  * deleted test/testdata/invalid-stripped because the stripped tests
    don't exist in 1.0
2009-09-14 10:28:03 +03:00
Petri Lehtinen
ab3764ed0a test/json-compare.py: Use json module from Python >=2.6 or simplejson
Backported from master, commit 9d16ec755c
2009-09-14 10:27:51 +03:00
Petri Lehtinen
5406c2b3d3 load: Check for integer and real overlfows and underflows 2009-09-13 13:18:01 +03:00
Petri Lehtinen
743af38e7f Use unsigned long instead of uint32_t
Some day we will have ANSI C compatibility... This change doesn't make
the API backwards incompatible because uint32_t was only used in flags
to json_dump*() and the flags are meant to be used only by ORing
constants and macro output, and actually currently only JSON_INDENT
can be used.
2009-09-13 13:16:34 +03:00
Petri Lehtinen
9d16ec755c test/json-compare.py: Use json module from Python >=2.6 or simplejson 2009-09-11 22:22:34 +03:00
Petri Lehtinen
04d550b02e Add stripped unit tests for decoder
That is, test cases where there's no newline or other whitespace at
the beginning or end of input. This was implemented by adding a
--strip option to split-testfile to strip the input file after writing
it.

The actual test JSON texts are the same as testdata/invalid and
testdata/valid. The expected output of the invalid cases had to be
adjusted a bit: because there's no newline at the end, some of the
line numbers needed to be changed.
2009-09-08 17:03:01 +03:00
Petri Lehtinen
55d2566539 Merge branch '1.0' into HEAD
Conflicts:
	configure.ac
	doc/conf.py
2009-09-08 17:02:39 +03:00
Petri Lehtinen
9cc6fbe580 Distribute CHANGES 2009-09-08 16:57:45 +03:00
Petri Lehtinen
827a01937f jansson 1.0.2 2009-09-08 16:48:26 +03:00
Petri Lehtinen
0f62dac627 load: Handle EOF correctly
In stream_get(), EOF never got it to stream->buffer and because of
this, stream_unget() failed on some situations. This patch makes
stream_get() handle EOF just like any other byte.

As a "side effect", lex_scan_string() now needs to unget the EOF, or
otherwise it ends up in error message on premature end of input.
2009-09-08 16:41:07 +03:00
Petri Lehtinen
7ee974e91c Don't perform reference counting on true, false and null
This makes their constructors thread safe. A special reference count
-1 is used to test whether to perform reference counting on a value or
not.
2009-09-07 21:40:14 +03:00
Petri Lehtinen
c288188a0f test/.gitignore: Add testprogs/test_simple 2009-09-07 21:25:22 +03:00
Petri Lehtinen
057ba29a27 doc apiref: Enhancements
Constructors are described more clearly and return values on error
situations more compehensively. Also add an example of the object
iteration protocol.
2009-09-07 21:09:55 +03:00
Petri Lehtinen
234ee47281 Better argument validation
All pointer arguments are now tested for NULL. json_string() now also
tests that strdup() succeeds. This is to ensure that no NULL values
end up in data structures.

Also desribe the different sources of errors in documentation.
2009-09-06 22:24:55 +03:00
Petri Lehtinen
98a8c1aebf Don't include unistd.h
It's not needed.
2009-09-06 22:24:22 +03:00
Petri Lehtinen
42e546d065 doc apiref: json_incref() returns its argument 2009-09-06 22:16:38 +03:00
Petri Lehtinen
6ffb04f0d4 Expand test coverage
Now all public API functions are tested (at least on some level) in
the test-api suite.
2009-09-06 14:06:02 +03:00
Petri Lehtinen
fd259ff68c Merge branch '1.0'
Conflicts:
	configure.ac
	doc/conf.py
2009-09-06 12:53:38 +03:00
Petri Lehtinen
ab2d93b724 Add CHANGES 2009-09-06 12:45:47 +03:00
Petri Lehtinen
e4be4a4a28 jansson 1.0.1 2009-09-04 20:58:55 +03:00
Petri Lehtinen
78eda92908 jansson.h: Fix typo
json_is_true was spelled jsin_is_true. Quite fatal.
2009-09-04 15:21:00 +03:00
Petri Lehtinen
9611780907 dump: Optimize indenting
Don't alloca() a whitespace buffer and fill it with spaces in each
call to dump_indent. Instead, use a static whitespace buffer.

As a bonus, this saves the use of poorly portable alloca().
2009-09-04 09:52:40 +03:00
Petri Lehtinen
93c5892bc3 load: Factor out an unneeded strdup
By "stealing" the string parsed out in lexer, one strdup can be saved.
2009-09-04 09:52:40 +03:00
Petri Lehtinen
1095ca956b Don't define -std=c99 in AM_CFLAGS
It is not needed.
2009-09-04 09:52:40 +03:00
Petri Lehtinen
05654bfcba doc: Fix typo 2009-09-04 09:52:40 +03:00
Petri Lehtinen
89d09813c3 Add reference stealing functions for inserting values to objects and arrays
The non-stealing functions are now just simple wrappers around these.
2009-09-04 09:52:37 +03:00
Petri Lehtinen
5ac4914642 Change the version to 1.0+ 2009-09-02 23:10:46 +03:00
Petri Lehtinen
6b70406bf4 jansson 1.0 2009-08-25 21:50:47 +03:00
Petri Lehtinen
390b0ba633 Distribute appropriate files 2009-08-25 21:48:34 +03:00
Petri Lehtinen
bf0d383961 test: Add Makefile.am to test/testprogs
This way it's an individual subdirectory and things go easier.
2009-08-25 21:23:26 +03:00
Petri Lehtinen
6e17271fa9 Add some missing copyright notices 2009-08-25 17:50:41 +03:00
Petri Lehtinen
ee2d164025 Detect garbage near EOF in json_loadf() and json_load_file() 2009-08-24 20:58:59 +03:00
Petri Lehtinen
b3e265eb84 Add test for numbers 2009-08-24 20:54:40 +03:00
Petri Lehtinen
0565988d12 Expand value test coverage 2009-08-23 13:34:12 +03:00
Petri Lehtinen
114fc96f76 array: Fix a few checks and a leak 2009-08-23 13:34:12 +03:00
Petri Lehtinen
c21ade41e0 run-test: Don't remove all testlogs when starting a new test suite 2009-08-23 13:34:12 +03:00
Petri Lehtinen
251722d499 Add README and API reference 2009-08-13 18:38:03 +03:00
Petri Lehtinen
0428f48d19 Refuse to dump other types than array and object as the root value 2009-08-04 20:58:02 +03:00
Petri Lehtinen
36530d8c25 Remove unimplemented json_clone() 2009-07-30 11:32:27 +03:00
Petri Lehtinen
08d712d038 Add macro json_is_boolean 2009-07-30 11:32:27 +03:00
Petri Lehtinen
2f4d6f8ae7 Add LICENSE and a copyright note to all sources 2009-07-30 11:32:24 +03:00
Petri Lehtinen
f41e380984 Rename json_{load,dump} to json_{load,dump}_file 2009-07-28 10:58:13 +03:00
Petri Lehtinen
b348519e96 Fix some memory leaks and invalid memory references 2009-07-28 10:38:21 +03:00
Petri Lehtinen
f60c563bab Enhance test system
- Tests are now named
- Testlogs are preserved between runs
- Tests can be run through Valgrind Memcheck tool
2009-07-28 10:36:16 +03:00
Petri Lehtinen
d3b3055a34 Expand encoder test coverage 2009-07-26 21:51:45 +03:00
Petri Lehtinen
20efe4aa26 Expand parser and Unicode test coverage 2009-07-26 11:31:25 +03:00