summaryrefslogtreecommitdiff
path: root/src/yajl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/yajl.c')
-rw-r--r--src/yajl.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/yajl.c b/src/yajl.c
index 05f150e..b4a6633 100644
--- a/src/yajl.c
+++ b/src/yajl.c
@@ -39,10 +39,24 @@
#include <assert.h>
const char *
-yajl_status_to_string(yajl_status code)
+yajl_status_to_string(yajl_status stat)
{
- /* XXX */
- return NULL;
+ const char * statStr = "unknown";
+ switch (stat) {
+ case yajl_status_ok:
+ statStr = "ok, no error";
+ break;
+ case yajl_status_client_canceled:
+ statStr = "client canceled parse";
+ break;
+ case yajl_status_insufficient_data:
+ statStr = "eof was met before the parse could complete";
+ break;
+ case yajl_status_error:
+ statStr = "parse error";
+ break;
+ }
+ return statStr;
}
yajl_handle
@@ -51,13 +65,12 @@ yajl_alloc(const yajl_callbacks * callbacks,
void * ctx)
{
unsigned int allowComments = 0;
-
+ yajl_handle hand = (yajl_handle) malloc(sizeof(struct yajl_handle_t));
+
if (config != NULL) {
allowComments = config->allowComments;
}
- yajl_handle hand = (yajl_handle) malloc(sizeof(struct yajl_handle_t));
-
hand->callbacks = callbacks;
hand->ctx = ctx;
hand->lexer = yajl_lex_alloc(allowComments);