From 5548c75e5507da6a0f9fb6a45a07a5cc6edd9393 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 19 Oct 2014 05:27:35 +0200 Subject: lua: expose JSON parser The JSON parser was introduced for the IPC protocol, but I guess it's useful here too. The motivation for this commit is the same as with 8e4fa5fc (again). --- misc/json.c | 5 +++++ misc/json.h | 1 + 2 files changed, 6 insertions(+) (limited to 'misc') diff --git a/misc/json.c b/misc/json.c index 489f087987..b301296ebe 100644 --- a/misc/json.c +++ b/misc/json.c @@ -70,6 +70,11 @@ static void eat_ws(char **src) } } +void json_skip_whitespace(char **src) +{ + eat_ws(src); +} + static int read_str(void *ta_parent, struct mpv_node *dst, char **src) { if (!eat_c(src, '"')) diff --git a/misc/json.h b/misc/json.h index e8551fe2a7..f5ad4cf258 100644 --- a/misc/json.h +++ b/misc/json.h @@ -22,6 +22,7 @@ #include "libmpv/client.h" int json_parse(void *ta_parent, struct mpv_node *dst, char **src, int max_depth); +void json_skip_whitespace(char **src); int json_write(char **s, struct mpv_node *src); #endif -- cgit v1.2.3