From 1e5ad7497a90dc4e39b21f3a8b5359049debd574 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Thu, 22 Sep 2011 22:37:30 +1100 Subject: [PATCH] + added wrapper around yajl_get_error() --- src/json2torrent.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/json2torrent.c b/src/json2torrent.c index b4960fa..cd27f04 100644 --- a/src/json2torrent.c +++ b/src/json2torrent.c @@ -54,6 +54,19 @@ yajl_callbacks callbacks = { write_end /* end array */ }; +void +check_yajl_error(struct yajl_handle_t *handle, unsigned char *buf, size_t read) +{ + unsigned char *yajl_error = NULL; + + if ((yajl_error = yajl_get_error(handle, 1, buf, read)) != NULL) + { + fwrite(buf, read, 1, stderr); + fputc('\n', stderr); + yajl_free_error(handle, yajl_error); + } +} + int main(int argc, char **argv) {