@@ -865,15 +865,14 @@ schema_mount_get_ctx_inline(struct lysc_ext_instance *ext, const struct lyd_node
865865LY_ERR
866866lyplg_ext_schema_mount_get_ctx (struct lysc_ext_instance * ext , const struct lyd_node * parent , const struct ly_ctx * * ext_ctx )
867867{
868- LY_ERR ret = LY_SUCCESS , r ;
868+ LY_ERR ret = LY_SUCCESS ;
869869 struct lyd_node * ext_data = NULL , * sm_root = NULL ;
870870 ly_bool ext_data_free = 0 , config , shared ;
871871
872872 * ext_ctx = NULL ;
873873
874874 /* get operational data with ietf-yang-library and ietf-yang-schema-mount data */
875- if ((r = lyplg_ext_get_data (ext -> module -> ctx , ext , parent , (void * * )& ext_data , & ext_data_free ))) {
876- ret = r ;
875+ if ((ret = lyplg_ext_get_data (ext -> module -> ctx , ext , parent , (void * * )& ext_data , & ext_data_free ))) {
877876 goto cleanup ;
878877 }
879878
@@ -882,14 +881,11 @@ lyplg_ext_schema_mount_get_ctx(struct lysc_ext_instance *ext, const struct lyd_n
882881 goto cleanup ;
883882 }
884883
885- if ((r = lyd_find_path (ext_data , "/ietf-yang-schema-mount:schema-mounts" , 0 , & sm_root ))) {
886- ret = r ;
887- goto cleanup ;
888- }
889- if (!sm_root ) {
890- lyplg_ext_compile_log (NULL , ext , LY_LLERR , LY_ENOT ,
891- "Missing \"ietf-yang-schema-mount:schema-mounts\" in provided extension data." );
892- ret = LY_ENOT ;
884+ if ((ret = lyd_find_path (ext_data , "/ietf-yang-schema-mount:schema-mounts" , 0 , & sm_root ))) {
885+ if (ret == LY_ENOTFOUND ) {
886+ lyplg_ext_compile_log (NULL , ext , LY_LLERR , ret ,
887+ "Missing \"ietf-yang-schema-mount:schema-mounts\" in provided extension data." );
888+ }
893889 goto cleanup ;
894890 }
895891
@@ -901,19 +897,17 @@ lyplg_ext_schema_mount_get_ctx(struct lysc_ext_instance *ext, const struct lyd_n
901897 }
902898
903899 /* learn about this mount point */
904- if ((r = schema_mount_get_smount (ext , ext_data , & config , & shared ))) {
905- ret = r ;
900+ if ((ret = schema_mount_get_smount (ext , ext_data , & config , & shared ))) {
906901 goto cleanup ;
907902 }
908903
909904 /* create/get the context for parsing the data */
910905 if (shared ) {
911- r = schema_mount_get_ctx_shared (ext , ext_data , config , ext_ctx );
906+ ret = schema_mount_get_ctx_shared (ext , ext_data , config , ext_ctx );
912907 } else {
913- r = schema_mount_get_ctx_inline (ext , ext_data , config , ext_ctx );
908+ ret = schema_mount_get_ctx_inline (ext , ext_data , config , ext_ctx );
914909 }
915- if (r ) {
916- ret = r ;
910+ if (ret ) {
917911 goto cleanup ;
918912 }
919913
@@ -1099,11 +1093,14 @@ lyplg_ext_schema_mount_get_parent_ref(const struct lysc_ext_instance *ext, const
10991093 struct ly_set * * refs )
11001094{
11011095 LY_ERR rc ;
1102- struct ly_set * pref_set = NULL ;
1103- struct ly_set * snode_set = NULL ;
1104- struct ly_set * results_set = NULL ;
1096+ struct ly_set * pref_set = NULL , * snode_set = NULL , * results_set = NULL ;
11051097 struct lyd_node * ext_data ;
11061098 ly_bool ext_data_free ;
1099+ struct lyd_node_term * term ;
1100+ struct lyd_value_xpath10 * xp_val ;
1101+ char * value ;
1102+ struct ly_err_item * err ;
1103+ uint32_t i , j ;
11071104
11081105 /* get operational data with ietf-yang-library and ietf-yang-schema-mount data */
11091106 if ((rc = lyplg_ext_get_data (ext -> module -> ctx , ext , parent , (void * * )& ext_data , & ext_data_free ))) {
@@ -1117,19 +1114,21 @@ lyplg_ext_schema_mount_get_parent_ref(const struct lysc_ext_instance *ext, const
11171114
11181115 LY_CHECK_GOTO (rc = ly_set_new (& results_set ), cleanup );
11191116
1120- for (uint32_t i = 0 ; i < pref_set -> count ; ++ i ) {
1121- struct lyd_node_term * term ;
1122- struct lyd_value_xpath10 * xp_val ;
1123- char * value ;
1124- struct ly_err_item * err ;
1125-
1117+ for (i = 0 ; i < pref_set -> count ; ++ i ) {
11261118 term = (struct lyd_node_term * )pref_set -> dnodes [i ];
1119+
11271120 LYD_VALUE_GET (& term -> value , xp_val );
1128- LY_CHECK_GOTO (rc = lyplg_type_print_xpath10_value (xp_val , LY_VALUE_JSON , NULL , & value , & err ), cleanup );
1121+ rc = lyplg_type_print_xpath10_value (xp_val , LY_VALUE_JSON , NULL , & value , & err );
1122+ if (rc ) {
1123+ ly_err_print (ext -> module -> ctx , err );
1124+ ly_err_free (err );
1125+ goto cleanup ;
1126+ }
11291127 LY_CHECK_ERR_GOTO (rc = lys_find_xpath (ext -> module -> ctx , NULL , value , 0 , & snode_set ), free (value ), cleanup );
11301128 free (value );
1131- for (uint32_t sn = 0 ; sn < snode_set -> count ; sn ++ ) {
1132- LY_CHECK_GOTO (rc = ly_set_add (results_set , snode_set -> snodes [sn ], 0 , NULL ), cleanup );
1129+
1130+ for (j = 0 ; j < snode_set -> count ; j ++ ) {
1131+ LY_CHECK_GOTO (rc = ly_set_add (results_set , snode_set -> snodes [j ], 0 , NULL ), cleanup );
11331132 }
11341133 ly_set_free (snode_set , NULL );
11351134 snode_set = NULL ;
0 commit comments