Commit Graph

582 Commits

Author SHA1 Message Date
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
Petri Lehtinen
b1fe723a7f Fix json_loadf and json_loadfd with empty input
Nothing was appended to strbuffer, so the buffer was left empty. An
empty strbuffer is not an empty string but NULL, so the result was a
segfault.

This patch fixes the problem by initializing strbuffer to an empty
string.
2009-06-30 13:55:20 +03:00
Petri Lehtinen
dc9b954b62 Print correct error message on premature end of array 2009-06-30 13:55:20 +03:00
Petri Lehtinen
ae5ed3ff70 Fix json_set_error
Both error->line and error->text were set improperly, sigh.
2009-06-15 22:30:52 +03:00
Petri Lehtinen
82dffff71f Don't use AM_MAINTAINER_MODE 2009-06-15 22:30:17 +03:00
Petri Lehtinen
acfee50d5b Add TODO 2009-06-15 13:53:53 +03:00
Petri Lehtinen
7dc6cfd9cc Fix a few memory leaks in json_parse_object() 2009-06-15 13:53:53 +03:00
Petri Lehtinen
d135a80e07 Implement json_load, json_loadf and json_loadfd 2009-06-15 13:53:50 +03:00
Petri Lehtinen
8c697312e4 strbuffer_value: Return a read-only pointer rather than duplicating the value 2009-06-13 22:27:23 +03:00
Petri Lehtinen
3e0134782b strbuffer: Allocate enough space for value initially 2009-06-13 22:26:23 +03:00
Petri Lehtinen
197d3aa160 Implement strbuffer
String buffer (strbuffer) is an object that resizes automatically when
data is added to it. It was implemented by generalizing the technique
used in json_dumps().
2009-06-11 08:56:11 +03:00
Petri Lehtinen
9b825f7b18 Move max() to util.h 2009-06-11 08:54:40 +03:00
Petri Lehtinen
7764f3f321 Implement json_dump and json_dumps 2009-06-09 22:37:31 +03:00
Petri Lehtinen
9e63004c43 Add autotools generated files to .gitignore 2009-05-16 22:26:51 +03:00
Petri Lehtinen
d1407bed3a Implement dumping to an fd 2009-05-16 15:15:01 +03:00
Petri Lehtinen
fdcf28b667 Refactor error reporting 2009-05-13 22:25:34 +03:00
Petri Lehtinen
6e160c146c Use autoconf, automake & libtool 2009-05-12 22:21:50 +03:00
Petri Lehtinen
0b58486ec4 Fix json_object_get 2009-05-12 22:15:48 +03:00
Petri Lehtinen
86e1481cdb Get rid of include/ 2009-05-12 22:07:50 +03:00
Petri Lehtinen
514bbeaf7f Parse an empty object correctly 2009-05-12 21:44:45 +03:00
Petri Lehtinen
9ea51b2855 Implement dumping to file 2009-05-12 21:44:45 +03:00
Petri Lehtinen
61d0111323 Bump hashtable, allocate object->hashtable statically
Hashtable code from git://github.com/akheron/hashtable.git commit
7331ba6acdb415a2af62ae3e93fdd39c2a83b768
2009-05-12 21:44:45 +03:00
Petri Lehtinen
a2adf6ec98 Add support for iterating over objects 2009-05-12 21:44:45 +03:00
Petri Lehtinen
17a69c2d66 Initial import 2009-05-12 21:44:01 +03:00