@@ -178,15 +178,16 @@ union_store_type(const struct ly_ctx *ctx, struct lysc_type_union *type_u, uint3
178178 LY_VALUE_FORMAT format ;
179179 void * prefix_data ;
180180 uint32_t opts = 0 , ti ;
181- struct lyplg_type * type_plugin ;
181+ struct lyplg_type * type_plg ;
182182
183183 * err = NULL ;
184184
185185 if (subvalue -> format == LY_VALUE_LYB ) {
186186 lyb_parse_union (subvalue -> original , subvalue -> orig_len , & ti , & value , & value_len );
187187 if (ti != type_idx ) {
188188 /* value of another type, first store the value properly and then use its JSON value for parsing */
189- rc = LYSC_GET_TYPE_PLG (type_u -> types [ti ]-> plugin_ref )-> store (ctx , type_u -> types [ti ], value , value_len ,
189+ type_plg = LYSC_GET_TYPE_PLG (type_u -> types [ti ]-> plugin_ref );
190+ rc = type_plg -> store (ctx , type_u -> types [ti ], value , value_len ,
190191 LYPLG_TYPE_STORE_ONLY , subvalue -> format , subvalue -> prefix_data , subvalue -> hints ,
191192 subvalue -> ctx_node , & subvalue -> value , unres , err );
192193 if ((rc != LY_SUCCESS ) && (rc != LY_EINCOMPLETE )) {
@@ -204,7 +205,7 @@ union_store_type(const struct ly_ctx *ctx, struct lysc_type_union *type_u, uint3
204205 value = strndup (value , value_len );
205206 dynamic = 1 ;
206207 }
207- LYSC_GET_TYPE_PLG ( type_u -> types [ ti ] -> plugin_ref ) -> free (ctx , & subvalue -> value );
208+ type_plg -> free (ctx , & subvalue -> value );
208209
209210 format = LY_VALUE_JSON ;
210211 prefix_data = NULL ;
@@ -226,9 +227,9 @@ union_store_type(const struct ly_ctx *ctx, struct lysc_type_union *type_u, uint3
226227 opts |= LYPLG_TYPE_STORE_DYNAMIC ;
227228 }
228229
229- type_plugin = LYSC_GET_TYPE_PLG (type -> plugin_ref );
230+ type_plg = LYSC_GET_TYPE_PLG (type -> plugin_ref );
230231
231- rc = type_plugin -> store (ctx , type , value , value_len , opts , format , prefix_data ,
232+ rc = type_plg -> store (ctx , type , value , value_len , opts , format , prefix_data ,
232233 subvalue -> hints , subvalue -> ctx_node , & subvalue -> value , unres , err );
233234 if ((rc != LY_SUCCESS ) && (rc != LY_EINCOMPLETE )) {
234235 /* clear any leftover/freed garbage */
@@ -238,10 +239,10 @@ union_store_type(const struct ly_ctx *ctx, struct lysc_type_union *type_u, uint3
238239
239240 if (validate && (rc == LY_EINCOMPLETE )) {
240241 /* we need the value validated */
241- rc = type_plugin -> validate (ctx , type , ctx_node , tree , & subvalue -> value , err );
242+ rc = type_plg -> validate (ctx , type , ctx_node , tree , & subvalue -> value , err );
242243 if (rc ) {
243244 /* validate failed, we need to free the stored value */
244- type_plugin -> free (ctx , & subvalue -> value );
245+ type_plg -> free (ctx , & subvalue -> value );
245246 }
246247 }
247248
@@ -274,7 +275,7 @@ union_find_type(const struct ly_ctx *ctx, struct lysc_type_union *type_u, struct
274275 uint32_t * prev_lo , temp_lo = 0 ;
275276 char * msg = NULL ;
276277 int msg_len = 0 ;
277- struct lyplg_type * type ;
278+ struct lyplg_type * type_plg ;
278279
279280 * err = NULL ;
280281
@@ -312,11 +313,11 @@ union_find_type(const struct ly_ctx *ctx, struct lysc_type_union *type_u, struct
312313 continue ;
313314 }
314315
315- type = LYSC_GET_TYPE_PLG (type_u -> types [u ]-> plugin_ref );
316+ type_plg = LYSC_GET_TYPE_PLG (type_u -> types [u ]-> plugin_ref );
316317
317- msg = ly_realloc (msg , msg_len + 4 + strlen (type -> id ) + 2 + strlen (errs [u ]-> msg ) + 2 );
318+ msg = ly_realloc (msg , msg_len + 4 + strlen (type_plg -> id ) + 2 + strlen (errs [u ]-> msg ) + 2 );
318319 LY_CHECK_ERR_GOTO (!msg , ret = LY_EMEM , cleanup );
319- msg_len += sprintf (msg + msg_len , " %s: %s\n" , type -> id , errs [u ]-> msg );
320+ msg_len += sprintf (msg + msg_len , " %s: %s\n" , type_plg -> id , errs [u ]-> msg );
320321 }
321322
322323 ret = ly_err_new (err , LY_EVALID , LYVE_DATA , NULL , NULL , "%s" , msg );
@@ -451,16 +452,16 @@ lyplg_type_validate_union(const struct ly_ctx *ctx, const struct lysc_type *type
451452 struct lyd_value orig = {0 };
452453 uint32_t type_idx ;
453454 ly_bool validated = 0 ;
454- struct lyplg_type * subvalue_type ;
455+ struct lyplg_type * subvalue_type_plg ;
455456
456457 * err = NULL ;
457458
458459 /* because of types that do not store their own type as realtype (leafref), we are not able to call their
459460 * validate callback (there is no way to get the type) but even if possible, the value may be invalid
460461 * for the type, so we may have to perform union value storing again from scratch, but keep a value backup */
461- subvalue_type = LYSC_GET_TYPE_PLG (subvalue -> value .realtype -> plugin_ref );
462- LY_CHECK_RET (subvalue_type -> duplicate (ctx , & subvalue -> value , & orig ));
463- subvalue_type -> free (ctx , & subvalue -> value );
462+ subvalue_type_plg = LYSC_GET_TYPE_PLG (subvalue -> value .realtype -> plugin_ref );
463+ LY_CHECK_RET (subvalue_type_plg -> duplicate (ctx , & subvalue -> value , & orig ));
464+ subvalue_type_plg -> free (ctx , & subvalue -> value );
464465
465466 if (subvalue -> format == LY_VALUE_LYB ) {
466467 /* use the specific type to store and validate the value */
@@ -600,7 +601,6 @@ lyplg_type_print_union(const struct ly_ctx *ctx, const struct lyd_value *value,
600601 struct lyd_value_union * subvalue = value -> subvalue ;
601602 struct lysc_type_union * type_u = (struct lysc_type_union * )value -> realtype ;
602603 size_t lyb_data_len = 0 ;
603- struct lyplg_type * type ;
604604
605605 if ((format == LY_VALUE_LYB ) && (subvalue -> format == LY_VALUE_LYB )) {
606606 /* The return value is already ready. */
@@ -620,8 +620,8 @@ lyplg_type_print_union(const struct ly_ctx *ctx, const struct lyd_value *value,
620620 }
621621
622622 assert (format != LY_VALUE_LYB );
623- type = LYSC_GET_TYPE_PLG (subvalue -> value .realtype -> plugin_ref );
624- ret = ( void * ) type -> print ( ctx , & subvalue -> value , format , prefix_data , dynamic , value_len );
623+ ret = ( void * ) LYSC_GET_TYPE_PLG (subvalue -> value .realtype -> plugin_ref )-> print ( ctx , & subvalue -> value ,
624+ format , prefix_data , dynamic , value_len );
625625 if (!value -> _canonical && (format == LY_VALUE_CANON )) {
626626 /* the canonical value is supposed to be stored now */
627627 lydict_insert (ctx , subvalue -> value ._canonical , 0 , (const char * * )& value -> _canonical );
0 commit comments