summaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-19 05:27:35 +0200
committerwm4 <wm4@nowhere>2014-10-19 05:51:37 +0200
commit5548c75e5507da6a0f9fb6a45a07a5cc6edd9393 (patch)
treeabd1a7442abf056900a518ffa6bfe3606f1329cc /misc
parent987146362e35820cd96d7de4f48b13ec4ee25d7c (diff)
downloadmpv-5548c75e5507da6a0f9fb6a45a07a5cc6edd9393.tar.bz2
mpv-5548c75e5507da6a0f9fb6a45a07a5cc6edd9393.tar.xz
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).
Diffstat (limited to 'misc')
-rw-r--r--misc/json.c5
-rw-r--r--misc/json.h1
2 files changed, 6 insertions, 0 deletions
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