warnings and asserts
This commit is contained in:
parent
0d7351093b
commit
07fe90b4c4
4 changed files with 18 additions and 6 deletions
|
|
@ -408,7 +408,7 @@ api_data_put(clicon_handle h,
|
||||||
cbuf *cbx = NULL;
|
cbuf *cbx = NULL;
|
||||||
cxobj *x;
|
cxobj *x;
|
||||||
cxobj *xbot = NULL;
|
cxobj *xbot = NULL;
|
||||||
cxobj *xtop;
|
cxobj *xtop = NULL;
|
||||||
cxobj *xp;
|
cxobj *xp;
|
||||||
yang_node *y = NULL;
|
yang_node *y = NULL;
|
||||||
yang_spec *yspec;
|
yang_spec *yspec;
|
||||||
|
|
|
||||||
|
|
@ -773,6 +773,11 @@ text_put(xmldb_handle xh,
|
||||||
clicon_err(OE_XML, 0, "dbfile NULL");
|
clicon_err(OE_XML, 0, "dbfile NULL");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
if (x1 && strcmp(xml_name(x1),"config")!=0){
|
||||||
|
clicon_err(OE_XML, 0, "Top-level symbol of modification tree is %s, expected \"config\"",
|
||||||
|
xml_name(x1));
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
if ((yspec = th->th_yangspec) == NULL){
|
if ((yspec = th->th_yangspec) == NULL){
|
||||||
clicon_err(OE_YANG, ENOENT, "No yang spec");
|
clicon_err(OE_YANG, ENOENT, "No yang spec");
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -797,8 +802,13 @@ text_put(xmldb_handle xh,
|
||||||
if (singleconfigroot(x0, &x0) < 0)
|
if (singleconfigroot(x0, &x0) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
assert(strcmp(xml_name(x0),"config")==0);
|
|
||||||
/* Here x0 looks like: <config>...</config> */
|
/* Here x0 looks like: <config>...</config> */
|
||||||
|
if (strcmp(xml_name(x0),"config")!=0){
|
||||||
|
clicon_err(OE_XML, 0, "Top-level symbol is %s, expected \"config\"",
|
||||||
|
xml_name(x0));
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
/* Validate existing config tree */
|
/* Validate existing config tree */
|
||||||
if (xml_apply(x0, CX_ELMNT, xml_spec_populate, yspec) < 0)
|
if (xml_apply(x0, CX_ELMNT, xml_spec_populate, yspec) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
||||||
|
|
@ -1473,7 +1473,9 @@ api_path2xml_vec(char **vec,
|
||||||
yang_stmt *y = NULL;
|
yang_stmt *y = NULL;
|
||||||
|
|
||||||
if ((name = vec[0]) == NULL){
|
if ((name = vec[0]) == NULL){
|
||||||
|
if (xpathp)
|
||||||
*xpathp = x0;
|
*xpathp = x0;
|
||||||
|
if (ypathp)
|
||||||
*ypathp = y0;
|
*ypathp = y0;
|
||||||
return 0;
|
return 0;
|
||||||
} /* E.g "x=1,2" -> name:x restval=1,2 */
|
} /* E.g "x=1,2" -> name:x restval=1,2 */
|
||||||
|
|
|
||||||
|
|
@ -168,12 +168,12 @@ xml_parse_bslash1(struct xml_parse_yacc_arg *ya,
|
||||||
cxobj *xc;
|
cxobj *xc;
|
||||||
|
|
||||||
if (strcmp(xml_name(x), name)){
|
if (strcmp(xml_name(x), name)){
|
||||||
clicon_err(OE_XML, 0, "Sanity check failed: %s vs %s",
|
clicon_err(OE_XML, 0, "XML parse sanity check failed: %s vs %s",
|
||||||
xml_name(x), name);
|
xml_name(x), name);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (xml_namespace(x)!=NULL){
|
if (xml_namespace(x)!=NULL){
|
||||||
clicon_err(OE_XML, 0, "Sanity check failed: %s:%s vs %s\n",
|
clicon_err(OE_XML, 0, "XML parse sanity check failed: %s:%s vs %s\n",
|
||||||
xml_namespace(x), xml_name(x), name);
|
xml_namespace(x), xml_name(x), name);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue