From c75bb4b08faaf6db0141b0dce623e9d2a06d175c Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 14 Apr 2016 11:01:09 +0200 Subject: [PATCH] mdhelp: reuse class doc from parent --- src/idnode.c | 11 +++++++++++ src/idnode.h | 1 + src/webui/doc_md.c | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/idnode.c b/src/idnode.c index cf8f67fd4..0ab797753 100644 --- a/src/idnode.c +++ b/src/idnode.c @@ -1298,6 +1298,17 @@ idclass_get_order (const idclass_t *idc) return NULL; } +const char ** +idclass_get_doc (const idclass_t *idc) +{ + while (idc) { + if (idc->ic_doc) + return idc->ic_doc; + idc = idc->ic_super; + } + return NULL; +} + static htsmsg_t * idclass_get_property_groups (const idclass_t *idc, const char *lang) { diff --git a/src/idnode.h b/src/idnode.h index f30ba6a17..0db8c9914 100644 --- a/src/idnode.h +++ b/src/idnode.h @@ -227,6 +227,7 @@ void idclass_register ( const idclass_t *idc ); const idclass_t *idclass_find ( const char *name ); idclass_t const **idclass_find_all(void); idclass_t const **idclass_find_children(const char *name); +const char **idclass_get_doc(const idclass_t *idc); const char *idclass_get_caption ( const idclass_t *idc, const char *lang ); htsmsg_t *idclass_serialize0 (const idclass_t *idc, htsmsg_t *list, int optmask, const char *lang); htsmsg_t *idnode_serialize0 (idnode_t *self, htsmsg_t *list, int optmask, const char *lang); diff --git a/src/webui/doc_md.c b/src/webui/doc_md.c index add004842..3acda5fa7 100644 --- a/src/webui/doc_md.c +++ b/src/webui/doc_md.c @@ -139,7 +139,7 @@ http_markdown_class(http_connection_t *hc, const char *clazz) pthread_mutex_unlock(&global_lock); return HTTP_STATUS_NOT_FOUND; } - doc = ic->ic_doc; + doc = idclass_get_doc(ic); m = idclass_serializedoc(ic, lang); pthread_mutex_unlock(&global_lock); s = htsmsg_get_str(m, "caption"); -- 2.47.3