path: root/options/m_property.h
diff options
authorwm4 <wm4@nowhere>2014-03-30 13:41:03 +0200
committerwm4 <wm4@nowhere>2014-03-30 13:41:03 +0200
commit5cd20c73208e6fca063f829c86dd4cd22f55a31a (patch)
tree19437ad82631d4fdb7b4acc3b57620c4866e9bc5 /options/m_property.h
parent7cc985f3d01dbb27f17231793713caa6565e42ee (diff)
command: add helper function to split property paths
We've just checked whether a sub-path started with "name/", but that changes behavior whether the property name has a trailing '/' or not. Using a helper function to split of path components avoids this problem.
Diffstat (limited to 'options/m_property.h')
1 files changed, 6 insertions, 0 deletions
diff --git a/options/m_property.h b/options/m_property.h
index 6fc27301b5..808066dde6 100644
--- a/options/m_property.h
+++ b/options/m_property.h
@@ -122,6 +122,12 @@ enum mp_property_return {
int m_property_do(struct mp_log *log, const struct m_option* prop_list,
const char* property_name, int action, void* arg, void *ctx);
+// Given a path of the form "a/b/c", this function will set *prefix to "a",
+// and rem to "b/c", and return true.
+// If there is no '/' in the path, set prefix to path, and rem to "", and
+// return false.
+bool m_property_split_path(const char *path, bstr *prefix, char **rem);
// Print a list of properties.
void m_properties_print_help_list(struct mp_log *log,
const struct m_option* list);