C-style update: Unified comment, retvals in order, remove trailing spaces
Changed function name for `clicon_debug` functions
This commit is contained in:
parent
6e314dd96f
commit
62348fc9c7
204 changed files with 6047 additions and 4904 deletions
|
|
@ -191,8 +191,8 @@ arraytype2str(enum array_element_type lt)
|
|||
* @retval arraytype Type of array
|
||||
*/
|
||||
static enum array_element_type
|
||||
array_eval(cxobj *xprev,
|
||||
cxobj *x,
|
||||
array_eval(cxobj *xprev,
|
||||
cxobj *x,
|
||||
cxobj *xnext)
|
||||
{
|
||||
enum array_element_type arraytype = NO_ARRAY;
|
||||
|
|
@ -207,7 +207,7 @@ array_eval(cxobj *xprev,
|
|||
arraytype = BODY_ARRAY;
|
||||
goto done;
|
||||
}
|
||||
if (xnext &&
|
||||
if (xnext &&
|
||||
xml_type(xnext)==CX_ELMNT &&
|
||||
strcmp(xml_name(x), xml_name(xnext))==0){
|
||||
ns2 = xml_find_type_value(xnext, NULL, "xmlns", CX_ATTR);
|
||||
|
|
@ -245,15 +245,16 @@ array_eval(cxobj *xprev,
|
|||
*
|
||||
* @param[out] cb cbuf (encoded)
|
||||
* @param[in] str string (unencoded)
|
||||
* @retval 0 OK
|
||||
*/
|
||||
static int
|
||||
json_str_escape_cdata(cbuf *cb,
|
||||
char *str)
|
||||
{
|
||||
int retval = -1;
|
||||
int i;
|
||||
int retval = -1;
|
||||
size_t len;
|
||||
|
||||
int i;
|
||||
|
||||
len = strlen(str);
|
||||
for (i=0; i<len; i++)
|
||||
switch (str[i]){
|
||||
|
|
@ -315,8 +316,8 @@ json2xml_decode_identityref(cxobj *x,
|
|||
cvec *nsc = NULL;
|
||||
char *prefix2 = NULL;
|
||||
cbuf *cbv = NULL;
|
||||
|
||||
clicon_debug(1, "%s", __FUNCTION__);
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
yspec = ys_spec(y);
|
||||
if ((xb = xml_body_get(x)) == NULL)
|
||||
goto ok;
|
||||
|
|
@ -334,7 +335,7 @@ json2xml_decode_identityref(cxobj *x,
|
|||
*/
|
||||
if (xml_nsctx_node(x, &nsc) < 0)
|
||||
goto done;
|
||||
clicon_debug(1, "%s prefix:%s body:%s namespace:%s",
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s prefix:%s body:%s namespace:%s",
|
||||
__FUNCTION__, prefix, body, ns);
|
||||
if (!xml_nsctx_get_prefix(nsc, ns, &prefix2)){
|
||||
/* (no) insert a xmlns:<prefix> statement
|
||||
|
|
@ -368,7 +369,7 @@ json2xml_decode_identityref(cxobj *x,
|
|||
else{
|
||||
if (xerr && netconf_unknown_namespace_xml(xerr, "application",
|
||||
prefix,
|
||||
"No module corresponding to prefix") < 0)
|
||||
"No module corresponding to prefix") < 0)
|
||||
goto done;
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -449,10 +450,12 @@ json2xml_decode(cxobj *x,
|
|||
|
||||
/*! Encode leaf/leaf_list identityref type from XML to JSON
|
||||
*
|
||||
* @param[in] x XML body node
|
||||
* @param[in] body body string
|
||||
* @param[in] ys Yang spec of parent
|
||||
* @param[out] cb Encoded string
|
||||
* @param[in] x XML body node
|
||||
* @param[in] body body string
|
||||
* @param[in] ys Yang spec of parent
|
||||
* @param[out] cb Encoded string
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
*/
|
||||
static int
|
||||
xml2json_encode_identityref(cxobj *xb,
|
||||
|
|
@ -468,7 +471,7 @@ xml2json_encode_identityref(cxobj *xb,
|
|||
yang_stmt *yspec;
|
||||
yang_stmt *my_ymod;
|
||||
|
||||
clicon_debug(1, "%s %s", __FUNCTION__, body);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s", __FUNCTION__, body);
|
||||
my_ymod = ys_module(yp);
|
||||
yspec = ys_spec(yp);
|
||||
if (nodeid_split(body, &prefix, &id) < 0)
|
||||
|
|
@ -477,7 +480,7 @@ xml2json_encode_identityref(cxobj *xb,
|
|||
if (xml2ns(xb, prefix, &namespace) < 0)
|
||||
goto done;
|
||||
/* We got the namespace, now get the module */
|
||||
// clicon_debug(1, "%s body:%s prefix:%s namespace:%s", __FUNCTION__, body, prefix, namespace);
|
||||
// clixon_debug(CLIXON_DBG_DEFAULT, "%s body:%s prefix:%s namespace:%s", __FUNCTION__, body, prefix, namespace);
|
||||
#ifdef IDENTITYREF_KLUDGE
|
||||
if (namespace == NULL){
|
||||
/* If we dont find namespace here, we assume it is because of a missing
|
||||
|
|
@ -493,7 +496,6 @@ xml2json_encode_identityref(cxobj *xb,
|
|||
#endif
|
||||
{
|
||||
if ((ymod = yang_find_module_by_namespace(yspec, namespace)) != NULL){
|
||||
|
||||
if (ymod == my_ymod)
|
||||
cprintf(cb, "%s", id);
|
||||
else{
|
||||
|
|
@ -514,10 +516,12 @@ xml2json_encode_identityref(cxobj *xb,
|
|||
|
||||
/*! Encode leaf/leaf_list types from XML to JSON
|
||||
*
|
||||
* @param[in] xb XML body
|
||||
* @param[in] xp XML parent
|
||||
* @param[in] yp Yang spec of parent
|
||||
* @param[out] cb0 Encoded string
|
||||
* @param[in] xb XML body
|
||||
* @param[in] xp XML parent
|
||||
* @param[in] yp Yang spec of parent
|
||||
* @param[out] cb0 Encoded string
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
*/
|
||||
static int
|
||||
xml2json_encode_leafs(cxobj *xb,
|
||||
|
|
@ -541,7 +545,7 @@ xml2json_encode_leafs(cxobj *xb,
|
|||
}
|
||||
body = xb?xml_value(xb):NULL;
|
||||
if (yp == NULL){
|
||||
cprintf(cb, "%s", body?body:"null");
|
||||
cprintf(cb, "%s", body?body:"null");
|
||||
goto ok; /* unknown */
|
||||
}
|
||||
keyword = yang_keyword_get(yp);
|
||||
|
|
@ -552,7 +556,7 @@ xml2json_encode_leafs(cxobj *xb,
|
|||
goto done;
|
||||
restype = ytype?yang_argument_get(ytype):NULL;
|
||||
cvtype = yang_type2cv(yp);
|
||||
switch (cvtype){
|
||||
switch (cvtype){
|
||||
case CGV_STRING:
|
||||
case CGV_REST:
|
||||
if (body==NULL)
|
||||
|
|
@ -738,6 +742,8 @@ json_metadata_encoding(cbuf *cb,
|
|||
* @param[in] pretty Pretty-print output (2 means debug)
|
||||
* @param[in] modname Name of yang module
|
||||
* @param[in,out] metacb Encode into cbuf
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
* @see RFC7952
|
||||
*/
|
||||
static int
|
||||
|
|
@ -754,7 +760,7 @@ xml2json_encode_attr(cxobj *xa,
|
|||
char *namespace = NULL;
|
||||
yang_stmt *ymod;
|
||||
enum rfc_6020 ykeyw;
|
||||
|
||||
|
||||
if (xml2ns(xa, xml_prefix(xa), &namespace) < 0)
|
||||
goto done;
|
||||
/* Check for (1) registered meta-data */
|
||||
|
|
@ -792,14 +798,16 @@ xml2json_encode_attr(cxobj *xa,
|
|||
|
||||
/*! Do the actual work of translating XML to JSON
|
||||
*
|
||||
* @param[out] cb Cligen text buffer containing json on exit
|
||||
* @param[in] x XML tree structure containing XML to translate
|
||||
* @param[in] arraytype Does x occur in a array (of its parent) and how?
|
||||
* @param[in] level Indentation level
|
||||
* @param[in] pretty Pretty-print output (2 means debug)
|
||||
* @param[in] flat Dont print NO_ARRAY object name (for _vec call)
|
||||
* @param[in] modname0
|
||||
* @param[out] metacbp Meta encoding of attribute
|
||||
* @param[out] cb Cligen text buffer containing json on exit
|
||||
* @param[in] x XML tree structure containing XML to translate
|
||||
* @param[in] arraytype Does x occur in a array (of its parent) and how?
|
||||
* @param[in] level Indentation level
|
||||
* @param[in] pretty Pretty-print output (2 means debug)
|
||||
* @param[in] flat Dont print NO_ARRAY object name (for _vec call)
|
||||
* @param[in] modname0
|
||||
* @param[out] metacbp Meta encoding of attribute
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
*
|
||||
* @note Does not work with XML attributes
|
||||
* The following matrix explains how the mapping is done.
|
||||
|
|
@ -829,7 +837,7 @@ xml2json_encode_attr(cxobj *xa,
|
|||
| |\n\t] |\n\t] |\n\t}\t] |
|
||||
+----------+--------------+--------------+--------------+
|
||||
*/
|
||||
static int
|
||||
static int
|
||||
xml2json1_cbuf(cbuf *cb,
|
||||
cxobj *x,
|
||||
enum array_element_type arraytype,
|
||||
|
|
@ -868,7 +876,7 @@ xml2json1_cbuf(cbuf *cb,
|
|||
}
|
||||
childt = child_type(x);
|
||||
if (pretty==2)
|
||||
cprintf(cb, "#%s_array, %s_child ",
|
||||
cprintf(cb, "#%s_array, %s_child ",
|
||||
arraytype2str(arraytype),
|
||||
childtype2str(childt));
|
||||
switch(arraytype){
|
||||
|
|
@ -880,7 +888,7 @@ xml2json1_cbuf(cbuf *cb,
|
|||
case NO_ARRAY:
|
||||
if (!flat){
|
||||
cprintf(cb, "%*s\"", pretty?(level*PRETTYPRINT_INDENT):0, "");
|
||||
if (modname)
|
||||
if (modname)
|
||||
cprintf(cb, "%s:", modname);
|
||||
cprintf(cb, "%s\":%s", xml_name(x), pretty?" ":"");
|
||||
}
|
||||
|
|
@ -905,7 +913,7 @@ xml2json1_cbuf(cbuf *cb,
|
|||
cprintf(cb, "%s:", modname);
|
||||
cprintf(cb, "%s\":%s", xml_name(x), pretty?" ":"");
|
||||
level++;
|
||||
cprintf(cb, "[%s%*s",
|
||||
cprintf(cb, "[%s%*s",
|
||||
pretty?"\n":"",
|
||||
pretty?(level*PRETTYPRINT_INDENT):0, "");
|
||||
switch (childt){
|
||||
|
|
@ -925,7 +933,7 @@ xml2json1_cbuf(cbuf *cb,
|
|||
case MIDDLE_ARRAY:
|
||||
case LAST_ARRAY:
|
||||
level++;
|
||||
cprintf(cb, "%*s",
|
||||
cprintf(cb, "%*s",
|
||||
pretty?(level*PRETTYPRINT_INDENT):0, "");
|
||||
switch (childt){
|
||||
case NULL_CHILD:
|
||||
|
|
@ -961,11 +969,11 @@ xml2json1_cbuf(cbuf *cb,
|
|||
goto done;
|
||||
continue;
|
||||
}
|
||||
xc_arraytype = array_eval(i?xml_child_i(x,i-1):NULL,
|
||||
xc,
|
||||
xc_arraytype = array_eval(i?xml_child_i(x,i-1):NULL,
|
||||
xc,
|
||||
xml_child_i(x, i+1));
|
||||
if (xml2json1_cbuf(cb,
|
||||
xc,
|
||||
if (xml2json1_cbuf(cb,
|
||||
xc,
|
||||
xc_arraytype,
|
||||
level+1, pretty, 0, modname0,
|
||||
metacbc) < 0)
|
||||
|
|
@ -988,7 +996,7 @@ xml2json1_cbuf(cbuf *cb,
|
|||
case BODY_CHILD:
|
||||
break;
|
||||
case ANY_CHILD:
|
||||
cprintf(cb, "%s%*s}",
|
||||
cprintf(cb, "%s%*s}",
|
||||
pretty?"\n":"",
|
||||
pretty?(level*PRETTYPRINT_INDENT):0, "");
|
||||
break;
|
||||
|
|
@ -1004,7 +1012,7 @@ xml2json1_cbuf(cbuf *cb,
|
|||
case BODY_CHILD:
|
||||
break;
|
||||
case ANY_CHILD:
|
||||
cprintf(cb, "%s%*s}",
|
||||
cprintf(cb, "%s%*s}",
|
||||
pretty?"\n":"",
|
||||
pretty?(level*PRETTYPRINT_INDENT):0, "");
|
||||
level--;
|
||||
|
|
@ -1021,7 +1029,7 @@ xml2json1_cbuf(cbuf *cb,
|
|||
cprintf(cb, "%s",pretty?"\n":"");
|
||||
break;
|
||||
case ANY_CHILD:
|
||||
cprintf(cb, "%s%*s}",
|
||||
cprintf(cb, "%s%*s}",
|
||||
pretty?"\n":"",
|
||||
pretty?(level*PRETTYPRINT_INDENT):0, "");
|
||||
cprintf(cb, "%s",pretty?"\n":"");
|
||||
|
|
@ -1058,9 +1066,9 @@ xml2json1_cbuf(cbuf *cb,
|
|||
* @see clixon_xml2cbuf XML corresponding function
|
||||
* @see xml2json_cbuf_vec Top symbol is list
|
||||
*/
|
||||
static int
|
||||
xml2json_cbuf1(cbuf *cb,
|
||||
cxobj *x,
|
||||
static int
|
||||
xml2json_cbuf1(cbuf *cb,
|
||||
cxobj *x,
|
||||
int pretty,
|
||||
int autocliext)
|
||||
{
|
||||
|
|
@ -1069,7 +1077,7 @@ xml2json_cbuf1(cbuf *cb,
|
|||
yang_stmt *y;
|
||||
enum array_element_type arraytype = NO_ARRAY;
|
||||
int exist = 0;
|
||||
|
||||
|
||||
y = xml_spec(x);
|
||||
if (autocliext && y != NULL) {
|
||||
if (yang_extension_value(y, "hide-show", CLIXON_AUTOCLI_NS, &exist, NULL) < 0)
|
||||
|
|
@ -1077,10 +1085,9 @@ xml2json_cbuf1(cbuf *cb,
|
|||
if (exist)
|
||||
goto ok;
|
||||
}
|
||||
cprintf(cb, "%*s{%s",
|
||||
pretty?level*PRETTYPRINT_INDENT:0,"",
|
||||
cprintf(cb, "%*s{%s",
|
||||
pretty?level*PRETTYPRINT_INDENT:0,"",
|
||||
pretty?"\n":"");
|
||||
|
||||
if (y != NULL){
|
||||
switch (yang_keyword_get(y)){
|
||||
case Y_LEAF_LIST:
|
||||
|
|
@ -1092,8 +1099,8 @@ xml2json_cbuf1(cbuf *cb,
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (xml2json1_cbuf(cb,
|
||||
x,
|
||||
if (xml2json1_cbuf(cb,
|
||||
x,
|
||||
arraytype,
|
||||
level+1,
|
||||
pretty,
|
||||
|
|
@ -1101,7 +1108,7 @@ xml2json_cbuf1(cbuf *cb,
|
|||
NULL, /* ancestor modname / namespace */
|
||||
NULL) < 0)
|
||||
goto done;
|
||||
cprintf(cb, "%s%*s}%s",
|
||||
cprintf(cb, "%s%*s}%s",
|
||||
pretty?"\n":"",
|
||||
pretty?level*PRETTYPRINT_INDENT:0,"",
|
||||
pretty?"\n":"");
|
||||
|
|
@ -1131,9 +1138,9 @@ xml2json_cbuf1(cbuf *cb,
|
|||
* @endcode
|
||||
* @see xml2json_cbuf where the top level object is included
|
||||
*/
|
||||
int
|
||||
clixon_json2cbuf(cbuf *cb,
|
||||
cxobj *xt,
|
||||
int
|
||||
clixon_json2cbuf(cbuf *cb,
|
||||
cxobj *xt,
|
||||
int pretty,
|
||||
int skiptop,
|
||||
int autocliext)
|
||||
|
|
@ -1175,8 +1182,8 @@ clixon_json2cbuf(cbuf *cb,
|
|||
* Example: <b/><c/> --> <a><b/><c/></a> --> {"b" : null,"c" : null}
|
||||
* @see clixon_json2cbuf
|
||||
*/
|
||||
int
|
||||
xml2json_cbuf_vec(cbuf *cb,
|
||||
int
|
||||
xml2json_cbuf_vec(cbuf *cb,
|
||||
cxobj **vec,
|
||||
size_t veclen,
|
||||
int pretty,
|
||||
|
|
@ -1188,7 +1195,7 @@ xml2json_cbuf_vec(cbuf *cb,
|
|||
int i;
|
||||
cxobj *xc0;
|
||||
cxobj *xc;
|
||||
cvec *nsc = NULL;
|
||||
cvec *nsc = NULL;
|
||||
|
||||
if ((xp = xml_new("xml2json", NULL, CX_ELMNT)) == NULL)
|
||||
goto done;
|
||||
|
|
@ -1220,8 +1227,8 @@ xml2json_cbuf_vec(cbuf *cb,
|
|||
cprintf(cb, "[%s", pretty?"\n":" ");
|
||||
level++;
|
||||
}
|
||||
if (xml2json1_cbuf(cb,
|
||||
xp,
|
||||
if (xml2json1_cbuf(cb,
|
||||
xp,
|
||||
NO_ARRAY,
|
||||
level,
|
||||
pretty,
|
||||
|
|
@ -1230,7 +1237,7 @@ xml2json_cbuf_vec(cbuf *cb,
|
|||
|
||||
if (0){
|
||||
level--;
|
||||
cprintf(cb, "%s]%s",
|
||||
cprintf(cb, "%s]%s",
|
||||
pretty?"\n":"",
|
||||
pretty?"\n":""); /* top object */
|
||||
}
|
||||
|
|
@ -1261,8 +1268,8 @@ xml2json_cbuf_vec(cbuf *cb,
|
|||
* goto err;
|
||||
* @endcode
|
||||
*/
|
||||
int
|
||||
clixon_json2file(FILE *f,
|
||||
int
|
||||
clixon_json2file(FILE *f,
|
||||
cxobj *xn,
|
||||
int pretty,
|
||||
clicon_output_cb *fn,
|
||||
|
|
@ -1294,7 +1301,7 @@ clixon_json2file(FILE *f,
|
|||
* @param[in] xn clicon xml tree
|
||||
*/
|
||||
int
|
||||
json_print(FILE *f,
|
||||
json_print(FILE *f,
|
||||
cxobj *x)
|
||||
{
|
||||
return clixon_json2file(f, x, 1, fprintf, 0, 0);
|
||||
|
|
@ -1316,8 +1323,8 @@ json_print(FILE *f,
|
|||
* Example: <b/><c/> --> <a><b/><c/></a> --> {"b" : null,"c" : null}
|
||||
* @see xml2json1_cbuf
|
||||
*/
|
||||
int
|
||||
xml2json_vec(FILE *f,
|
||||
int
|
||||
xml2json_vec(FILE *f,
|
||||
cxobj **vec,
|
||||
size_t veclen,
|
||||
int pretty,
|
||||
|
|
@ -1367,9 +1374,9 @@ json_xmlns_translate(yang_stmt *yspec,
|
|||
char *modname = NULL;
|
||||
cxobj *xc;
|
||||
int ret;
|
||||
|
||||
|
||||
if ((modname = xml_prefix(x)) != NULL){ /* prefix is here module name */
|
||||
/* Special case for ietf-netconf -> ietf-restconf translation
|
||||
/* Special case for ietf-netconf -> ietf-restconf translation
|
||||
* A special case is for return data on the form {"data":...}
|
||||
* See also xml2json1_cbuf
|
||||
*/
|
||||
|
|
@ -1419,16 +1426,16 @@ json_xmlns_translate(yang_stmt *yspec,
|
|||
* @param[in] yspec Yang specification (if rfc 7951)
|
||||
* @param[out] xt XML top of tree typically w/o children on entry (but created)
|
||||
* @param[out] xerr Reason for invalid returned as netconf err msg
|
||||
* @retval 1 OK and valid
|
||||
* @retval 0 Invalid (only if yang spec)
|
||||
* @retval -1 Error with clicon_err called
|
||||
*
|
||||
* @see _xml_parse for XML variant
|
||||
* @retval 1 OK and valid
|
||||
* @retval 0 Invalid (only if yang spec)
|
||||
* @retval -1 Error with clicon_err called
|
||||
* @see http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf
|
||||
* @see RFC 7951
|
||||
*/
|
||||
static int
|
||||
_json_parse(char *str,
|
||||
static int
|
||||
_json_parse(char *str,
|
||||
int rfc7951,
|
||||
yang_bind yb,
|
||||
yang_stmt *yspec,
|
||||
|
|
@ -1442,8 +1449,8 @@ _json_parse(char *str,
|
|||
cbuf *cberr = NULL;
|
||||
int i;
|
||||
int failed = 0; /* yang assignment */
|
||||
|
||||
clicon_debug(1, "%s %d %s", __FUNCTION__, yb, str);
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d %s", __FUNCTION__, yb, str);
|
||||
jy.jy_parse_string = str;
|
||||
jy.jy_linenum = 1;
|
||||
jy.jy_current = xt;
|
||||
|
|
@ -1506,7 +1513,7 @@ _json_parse(char *str,
|
|||
break;
|
||||
case YB_NONE:
|
||||
break;
|
||||
case YB_RPC:
|
||||
case YB_RPC:
|
||||
if ((ret = xml_bind_yang_rpc(NULL, x, yspec, xerr)) < 0)
|
||||
goto done;
|
||||
if (ret == 0)
|
||||
|
|
@ -1529,14 +1536,14 @@ _json_parse(char *str,
|
|||
goto done;
|
||||
retval = 1;
|
||||
done:
|
||||
clicon_debug(1, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
|
||||
if (cberr)
|
||||
cbuf_free(cberr);
|
||||
json_parse_exit(&jy);
|
||||
json_scan_exit(&jy);
|
||||
if (jy.jy_xvec)
|
||||
free(jy.jy_xvec);
|
||||
return retval;
|
||||
return retval;
|
||||
fail: /* invalid */
|
||||
retval = 0;
|
||||
goto done;
|
||||
|
|
@ -1564,15 +1571,15 @@ _json_parse(char *str,
|
|||
* @see clixon_xml_parse_string XML instead of JSON
|
||||
* @see clixon_json_parse_file From a file
|
||||
*/
|
||||
int
|
||||
clixon_json_parse_string(char *str,
|
||||
int
|
||||
clixon_json_parse_string(char *str,
|
||||
int rfc7951,
|
||||
yang_bind yb,
|
||||
yang_stmt *yspec,
|
||||
cxobj **xt,
|
||||
cxobj **xerr)
|
||||
{
|
||||
clicon_debug(1, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
if (xt==NULL){
|
||||
clicon_err(OE_JSON, EINVAL, "xt is NULL");
|
||||
return -1;
|
||||
|
|
@ -1602,6 +1609,9 @@ clixon_json_parse_string(char *str,
|
|||
* @param[in] yspec Yang specification, or NULL
|
||||
* @param[in,out] xt Pointer to (XML) parse tree. If empty, create.
|
||||
* @param[out] xerr Reason for invalid returned as netconf err msg
|
||||
* @retval 1 OK and valid
|
||||
* @retval 0 Invalid (only if yang spec) w xerr set
|
||||
* @retval -1 Error with clicon_err called
|
||||
*
|
||||
* @code
|
||||
* cxobj *xt = NULL;
|
||||
|
|
@ -1612,11 +1622,6 @@ clixon_json_parse_string(char *str,
|
|||
* @note you need to free the xml parse tree after use, using xml_free()
|
||||
* @note, If xt empty, a top-level symbol will be added so that <tree../> will be: <top><tree.../></tree></top>
|
||||
* @note May block on file I/O
|
||||
*
|
||||
* @retval 1 OK and valid
|
||||
* @retval 0 Invalid (only if yang spec) w xerr set
|
||||
* @retval -1 Error with clicon_err called
|
||||
*
|
||||
* @see clixon_json_parse_string
|
||||
* @see RFC7951
|
||||
*/
|
||||
|
|
@ -1685,7 +1690,7 @@ clixon_json_parse_file(FILE *fp,
|
|||
}
|
||||
if (jsonbuf)
|
||||
free(jsonbuf);
|
||||
return retval;
|
||||
return retval;
|
||||
fail:
|
||||
retval = 0;
|
||||
goto done;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue