Document and tweak json_load_callback()

Change the return value of json_load_callback_t to size_t, as it's
feels more correct. The callback should return (size_t)-1 on failure.

Issue #57.
This commit is contained in:
Petri Lehtinen
2012-03-26 21:52:01 +03:00
parent 873eddaf19
commit e8fd3e3085
4 changed files with 33 additions and 5 deletions

View File

@@ -18,7 +18,7 @@ struct my_source {
static const char my_str[] = "[\"A\", {\"B\": \"C\", \"e\": false}, 1, null, \"foo\"]";
static int greedy_reader(void *buf, size_t buflen, void *arg)
static size_t greedy_reader(void *buf, size_t buflen, void *arg)
{
struct my_source *s = arg;
if (buflen > s->cap - s->off)