Commit Graph

823 Commits

Author SHA1 Message Date
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
Petri Lehtinen
9240146c10 Implement support for \u escapes 2009-07-16 09:58:23 +03:00
Petri Lehtinen
a0435e3061 Show the whole UTF-8 sequence in error message, not just the first byte 2009-07-16 09:57:08 +03:00
Petri Lehtinen
7b702e8ad7 Remove TODO 2009-07-16 09:57:08 +03:00
Petri Lehtinen
df307f1bc3 Report errors from lexical and stream level in parser
Before, only the syntax level (parse_*) was able to set the error
string. This patch fixes the situation so that lexical (lex_*) and
stream (stream_*) levels can report detailed error messages.

Also, instead of 0, EOF is now returned by stream on error.
2009-07-14 00:24:39 +03:00
Petri Lehtinen
1f65a3cae7 Get rid of JSON_SORT_KEYS dump flag
Object sorting will be implemented later.
2009-07-13 23:38:04 +03:00
Petri Lehtinen
902bcdaa5e Decode and check for correct UTF-8
All strings (decoded JSON text, the argument of json_string(), the key
argument of json_object_set()) are checked for valid UTF-8.
2009-07-13 23:38:01 +03:00
Petri Lehtinen
625f50f916 Streamify the loader
It's no longer needed to load the whole input into a string and then
parse from the string. Instead, the input is read as needed from
a string or file.
2009-07-13 21:45:16 +03:00
Petri Lehtinen
4c414bdd6d Get rid of json_dumpfd and json_loadfd
fdopen() makes supporting separate API for file descriptors useless.
Supporting fd's also makes Jansson less portable.
2009-07-13 21:45:16 +03:00
Petri Lehtinen
1b67edb54d Little clean-up in parser
Before, json_loads checked for '[' or '{' at the beginning. Now
there's a dedicated function for that: parse_json(). Also rename
parse() to parse_value().
2009-07-13 21:45:16 +03:00
Petri Lehtinen
287ec3f9da Unify naming in parser
No functional changes.
2009-07-13 21:45:16 +03:00
Petri Lehtinen
13c7ad3219 Make the lexer not depend on locale
... by not using isalpha() and isspace(). While at it, fix some other
minor things.
2009-07-13 21:45:11 +03:00
Petri Lehtinen
68e948f567 Don't dump extra spaces when indenting 2009-07-09 21:01:43 +03:00
Petri Lehtinen
8ef778c843 Add some tests 2009-07-09 21:01:40 +03:00
Petri Lehtinen
6b14df13cc Fix dumping of Unicode control codes
Inside strings, All UTF-8 characters except for \, " and Unicode
control codes are dumped as-is. The control codes that have a special
one-character escape use that escape, and other control codes are
dumped using the \uXXXX escape.
2009-07-09 20:59:52 +03:00
Petri Lehtinen
f9c2a113bb Fix number tokenizer 2009-07-04 22:04:32 +03:00
Petri Lehtinen
4384776776 Fix empty array dumping 2009-07-04 13:19:41 +03:00
Petri Lehtinen
55af26f05a strbuffer: Optimize string termination
Do not zero all of the memory, just the first unused byte to make the
string null terminated.
2009-07-04 13:19:41 +03:00
Petri Lehtinen
b724c2b122 Separate integers and real numbers 2009-07-04 13:19:25 +03:00
Petri Lehtinen
39802813f4 Use -Werror 2009-06-30 13:55:20 +03:00