diff options
author | wm4 <wm4@nowhere> | 2018-05-12 14:48:24 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2018-05-24 19:56:34 +0200 |
commit | 1157f07c5b8b97112f9a6bde695aff8072a88fb2 (patch) | |
tree | 03cb53ab5789bca871228cef6698f97d87b92ac4 /misc/node.c | |
parent | 4fd3ad8d63aabeb1dc2448d650bb942d24163f54 (diff) | |
download | mpv-1157f07c5b8b97112f9a6bde695aff8072a88fb2.tar.bz2 mpv-1157f07c5b8b97112f9a6bde695aff8072a88fb2.tar.xz |
node: move a mpv_node helper from ipc.c to shared code
This particular one is needed in a following commit.
Diffstat (limited to 'misc/node.c')
-rw-r--r-- | misc/node.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/misc/node.c b/misc/node.c index b7bf06d9c1..f5fb8da0e9 100644 --- a/misc/node.c +++ b/misc/node.c @@ -81,3 +81,16 @@ void node_map_add_flag(struct mpv_node *dst, const char *key, bool v) { node_map_add(dst, key, MPV_FORMAT_FLAG)->u.flag = v; } + +mpv_node *node_map_get(mpv_node *src, const char *key) +{ + if (src->format != MPV_FORMAT_NODE_MAP) + return NULL; + + for (int i = 0; i < src->u.list->num; i++) { + if (strcmp(key, src->u.list->keys[i]) == 0) + return &src->u.list->values[i]; + } + + return NULL; +} |