Changed code so that it will be compatible with c++.

1. Added #ifdef extern "C" to public header files.
2. Changed variables that are key words in c++, to different names (like ns instead of namespace).
3. Changed char* to const char* for constant strings.
This commit is contained in:
shmuels 2020-07-02 15:00:53 +03:00
parent eda4a58ebf
commit 58ea4eba27
27 changed files with 274 additions and 119 deletions

View file

@ -1464,7 +1464,7 @@ xml_find_index_yang(cxobj *xp,
*
* @param[in] xp Parent xml node.
* @param[in] yp Yang spec of parent node or yang-spec/yang (Alternative if yc not given).
* @param[in] namespace Namespace (needed only if name is derived from top-symbol)
* @param[in] ns Namespace (needed only if name is derived from top-symbol)
* @param[in] name Name of child
* @param[in] cvk List of keys and values as CLIgen vector on the form k1=foo, k2=bar
* @param[out] xvec Array of result nodes. Must be initialized on entry
@ -1493,7 +1493,7 @@ xml_find_index_yang(cxobj *xp,
int
clixon_xml_find_index(cxobj *xp,
yang_stmt *yp,
char *namespace,
char *ns,
char *name,
cvec *cvk,
clixon_xvec *xvec)
@ -1514,7 +1514,7 @@ clixon_xml_find_index(cxobj *xp,
yp = xml_spec(xp);
if (yp){/* 2. YANG spec of parent + name derives yc. If not found use just name. */
if (yang_keyword_get(yp) == Y_SPEC)
yp = yang_find_module_by_namespace(yp, namespace);
yp = yang_find_module_by_namespace(yp, ns);
if (yp)
yc = yang_find_datanode(yp, name);
}
@ -1524,12 +1524,12 @@ clixon_xml_find_index(cxobj *xp,
if (ret == 0){ /* This means yang method did not work for some reason
* such as not being list key indexes in cvk, for example
*/
if (xml_find_noyang_name(xp, namespace, name, cvk, xvec) < 0)
if (xml_find_noyang_name(xp, ns, name, cvk, xvec) < 0)
goto done;
}
}
else
if (xml_find_noyang_name(xp, namespace, name, cvk, xvec) < 0)
if (xml_find_noyang_name(xp, ns, name, cvk, xvec) < 0)
goto done;
retval = 0;
done: