@@ -2373,10 +2373,13 @@ lysc_ext_find_definition(const struct ly_ctx *ctx, const struct lysp_ext_instanc
23732373}
23742374
23752375LY_ERR
2376- lysp_ext_instance_resolve_argument (const struct ly_ctx * ctx , const struct lysp_ext * ext_def , struct lysp_ext_instance * ext_p )
2376+ lysp_ext_instance_resolve_argument (const struct ly_ctx * ctx , const struct lysp_module * pmod ,
2377+ const struct lysp_ext * ext_def , struct lysp_ext_instance * ext_p )
23772378{
23782379 const char * ext , * arg , * prefix_arg , * name_arg , * prefix_ext , * name_ext ;
23792380 uint32_t prefix_arg_len , name_arg_len , prefix_ext_len , name_ext_len ;
2381+ struct lysp_stmt * stmt = NULL ;
2382+ char * path ;
23802383
23812384 if (!ext_def -> argname || ext_p -> argument ) {
23822385 /* nothing to do */
@@ -2385,8 +2388,6 @@ lysp_ext_instance_resolve_argument(const struct ly_ctx *ctx, const struct lysp_e
23852388
23862389 if (ext_p -> format == LY_VALUE_XML ) {
23872390 /* schema was parsed from YIN and an argument is expected, ... */
2388- struct lysp_stmt * stmt = NULL ;
2389-
23902391 if (ext_def -> flags & LYS_YINELEM_TRUE ) {
23912392 /* ... argument was the first XML child element */
23922393 for (stmt = ext_p -> child ; stmt && (stmt -> flags & LYS_YIN_ATTR ); stmt = stmt -> next ) {}
@@ -2396,9 +2397,15 @@ lysp_ext_instance_resolve_argument(const struct ly_ctx *ctx, const struct lysp_e
23962397 arg = stmt -> stmt ;
23972398 ly_parse_nodeid (& arg , & prefix_arg , & prefix_arg_len , & name_arg , & name_arg_len );
23982399 if (ly_strncmp (ext_def -> argname , name_arg , name_arg_len )) {
2400+ LY_CHECK_RET (lysp_ext_instance_path (ctx , pmod , ext_p , & path ));
2401+ ly_log_location (NULL , path , NULL );
2402+
23992403 LOGVAL (ctx , NULL , LYVE_SEMANTICS , "Extension instance \"%s\" expects argument element \"%s\" as its "
24002404 "first XML child, but \"%.*s\" element found." , ext_p -> name , ext_def -> argname ,
24012405 (int )name_arg_len , name_arg );
2406+
2407+ ly_log_location_revert (0 , 1 , 0 );
2408+ free (path );
24022409 return LY_EVALID ;
24032410 }
24042411
@@ -2409,8 +2416,14 @@ lysp_ext_instance_resolve_argument(const struct ly_ctx *ctx, const struct lysp_e
24092416
24102417 if (ly_resolve_prefix (ctx , prefix_ext , prefix_ext_len , ext_p -> format , ext_p -> prefix_data ) !=
24112418 ly_resolve_prefix (ctx , prefix_arg , prefix_arg_len , stmt -> format , stmt -> prefix_data )) {
2419+ LY_CHECK_RET (lysp_ext_instance_path (ctx , pmod , ext_p , & path ));
2420+ ly_log_location (NULL , path , NULL );
2421+
24122422 LOGVAL (ctx , NULL , LYVE_SEMANTICS , "Extension instance \"%s\" element and its argument element \"%s\" are "
24132423 "expected in the same namespace, but they differ." , ext_p -> name , ext_def -> argname );
2424+
2425+ ly_log_location_revert (0 , 1 , 0 );
2426+ free (path );
24142427 return LY_EVALID ;
24152428 }
24162429 }
@@ -2432,8 +2445,14 @@ lysp_ext_instance_resolve_argument(const struct ly_ctx *ctx, const struct lysp_e
24322445
24332446 if (!ext_p -> argument ) {
24342447 /* missing extension's argument */
2448+ LY_CHECK_RET (lysp_ext_instance_path (ctx , pmod , ext_p , & path ));
2449+ ly_log_location (NULL , path , NULL );
2450+
24352451 LOGVAL (ctx , NULL , LYVE_SEMANTICS , "Extension instance \"%s\" missing argument %s\"%s\"." ,
24362452 ext_p -> name , (ext_def -> flags & LYS_YINELEM_TRUE ) ? "element " : "" , ext_def -> argname );
2453+
2454+ ly_log_location_revert (0 , 1 , 0 );
2455+ free (path );
24372456 return LY_EVALID ;
24382457 }
24392458
0 commit comments