Minor fixes: UTF str: removed unused code, clarified loading of yang-lib load

This commit is contained in:
Olof hagsand 2023-10-20 10:01:44 +02:00
parent 856c9058f8
commit f6dbb30110
5 changed files with 14 additions and 17 deletions

View file

@ -1080,17 +1080,6 @@ clixon_unicode2utf8_one(uint16_t uc16,
clicon_err(OE_UNIX, EINVAL, "unicode2utf error");
goto done;
}
else if (uc16<0x10000) {
*utfstr++=224+uc16/4096;
*utfstr++=128+uc16/64%64;
*utfstr++=128+uc16%64;
}
else if (uc16<0x110000) {
*utfstr++=240+uc16/262144;
*utfstr++=128+uc16/4096%64;
*utfstr++=128+uc16/64%64;
*utfstr++=128+uc16%64;
}
else{
clicon_err(OE_UNIX, EINVAL, "unicode2utf error");
goto done;

View file

@ -883,10 +883,14 @@ yang_lib2yspec(clicon_handle h,
}
else if (yang_parse_module(h, "ietf-yang-library", "2019-01-04", yspec, NULL) < 0)
goto fail;
if (yang_parse_post(h, yspec, yang_len_get(yspec) - (1+veclen - modmin)) < 0)
if ((modmin = yang_len_get(yspec) - (1+veclen - modmin)) < 0)
goto fail;
if (yang_parse_post(h, yspec, modmin) < 0)
goto done;
#else
if (yang_parse_post(h, yspec, yang_len_get(yspec) - (veclen - modmin)) < 0)
if ((modmin = yang_len_get(yspec) - (1+veclen - modmin)) < 0)
goto fail;
if (yang_parse_post(h, yspec, modmin) < 0)
goto done;
#endif
retval = 1;

View file

@ -1436,6 +1436,10 @@ yang_parse_post(clicon_handle h,
struct yang_stmt **ylist = NULL; /* Topology sorted modules */
int ylen = 0; /* Length of ylist */
if (modmin < 0){
clicon_err(OE_YANG, EINVAL, "modmin negative");
goto done;
}
/* 1: Parse from text to yang parse-tree.
* Iterate through modules and detect module/submodules to parse
* NOTE: the list may grow on each iteration */

View file

@ -261,7 +261,7 @@ xml_yang_mount_get(clicon_handle h,
* @param[in] x XML moint-point node
* @param[in] yspec Yangspec for this mount-point (consumed)
* @retval 0 OK
* @retval -1 Error
* @retval -1 Error
*/
int
xml_yang_mount_set(cxobj *x,