Skip to content

Commit 3e3238f

Browse files
committed
schema mount UPDATE do not create redundant ctxs
1 parent 5cbbfb0 commit 3e3238f

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/ly_common.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,9 +817,11 @@ LY_ERR ly_strcat(char **dest, const char *format, ...) _FORMAT_PRINTF(2, 3);
817817
* @brief Get schema (context) for a mount point.
818818
*
819819
* @param[in] ext Compiled extension instance where the context is also stored.
820+
* @param[in] parent Data parent node instance of a schema node with @p ext instance. In special cases
821+
* (when not working with data) it can be NULL!
820822
* @param[out] ext_ctx Schema to use for parsing the data.
821823
* @return LY_ERR value.
822824
*/
823-
LY_ERR lyplg_ext_schema_mount_get_ctx(struct lysc_ext_instance *ext, const struct ly_ctx **ext_ctx);
825+
LY_ERR lyplg_ext_schema_mount_get_ctx(struct lysc_ext_instance *ext, const struct lyd_node *parent, const struct ly_ctx **ext_ctx);
824826

825827
#endif /* LY_COMMON_H_ */

src/plugins_exts/schema_mount.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,8 +774,8 @@ schema_mount_get_ctx_inline(struct lysc_ext_instance *ext, const struct lyd_node
774774
* @param[out] ext_ctx Schema to use for parsing the data.
775775
* @return LY_ERR value.
776776
*/
777-
static LY_ERR
778-
schema_mount_get_ctx(struct lysc_ext_instance *ext, const struct lyd_node *parent, const struct ly_ctx **ext_ctx)
777+
LY_ERR
778+
lyplg_ext_schema_mount_get_ctx(struct lysc_ext_instance *ext, const struct lyd_node *parent, const struct ly_ctx **ext_ctx)
779779
{
780780
LY_ERR ret = LY_SUCCESS, r;
781781
struct lyd_node *iter, *ext_data = NULL;
@@ -836,7 +836,7 @@ schema_mount_snode(struct lysc_ext_instance *ext, const struct lyd_node *parent,
836836
const struct ly_ctx *ext_ctx = NULL;
837837

838838
/* get context based on ietf-yang-library data */
839-
if ((r = schema_mount_get_ctx(ext, parent, &ext_ctx))) {
839+
if ((r = lyplg_ext_schema_mount_get_ctx(ext, parent, &ext_ctx))) {
840840
return r;
841841
}
842842

src/tree_schema.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ lys_getnext_(const struct lysc_node *last, const struct lysc_node *parent, const
259259
LY_ARRAY_FOR(parent->exts, u) {
260260
if (!strcmp(parent->exts[u].def->name, "mount-point") &&
261261
!strcmp(parent->exts[u].def->module->name, "ietf-yang-schema-mount")) {
262-
lyplg_ext_schema_mount_create_context(&parent->exts[u], NULL, &sm_ctx);
262+
lyplg_ext_schema_mount_get_ctx(&parent->exts[u], NULL, &sm_ctx);
263263
if (sm_ctx) {
264264
/* some usable context created */
265265
break;

0 commit comments

Comments
 (0)