working json test
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
diff --git a/json/json.c b/json/json.c
index 38a950b..ef8be52 100644
--- a/json/json.c
+++ b/json/json.c
@@ -17,11 +17,8 @@ s_tag * json_buf_parse (s_buf *buf, s_tag *dest)
{
character c;
sw r;
- s_buf_save save;
- s_tag tmp;
assert(buf);
assert(dest);
- buf_save_init(buf, &save);
if ((r = buf_peek_character_utf8(buf, &c)) < 0)
return NULL;
switch (c) {
@@ -49,8 +46,7 @@ s_tag * json_buf_parse (s_buf *buf, s_tag *dest)
default:
return NULL;
}
- *dest = tmp;
- return dest;
+ return NULL;
}
s_tag * json_buf_parse_bool (s_buf *buf, s_tag *dest)
@@ -91,6 +87,12 @@ s_tag * json_buf_parse_map (s_buf *buf, s_tag *dest)
if ((r = buf_parse_tag_str(buf, &(*k)->tag)) <= 0)
goto restore;
k = &(*k)->next.data.list;
+ if ((r = buf_ignore_spaces(buf)) < 0)
+ goto restore;
+ if ((r = buf_read_1(buf, ":")) <= 0)
+ goto restore;
+ if ((r = buf_ignore_spaces(buf)) < 0)
+ goto restore;
*v = list_new(NULL);
if (! *v)
goto restore;
@@ -140,14 +142,10 @@ s_tag * json_buf_parse_null (s_buf *buf, s_tag *dest)
s_tag * json_buf_parse_number (s_buf *buf, s_tag *dest)
{
- s_buf_save save;
assert(buf);
assert(dest);
- buf_save_init(buf, &save);
- if (! buf_parse_tag_number(buf, dest)) {
- buf_save_restore_rpos(buf, &save);
+ if (! buf_parse_tag_number(buf, dest))
return NULL;
- }
return dest;
}
diff --git a/test/json/.ikc3_history b/test/json/.ikc3_history
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/test/json/.ikc3_history
@@ -0,0 +1 @@
+
diff --git a/test/json/basics.ret.expected b/test/json/basics.ret.expected
index e69de29..573541a 100644
--- a/test/json/basics.ret.expected
+++ b/test/json/basics.ret.expected
@@ -0,0 +1 @@
+0