Merge branch 'mycpp/new-test' of https://github.com/shmuelnatan/clixon into shmuelnatan-mycpp/new-test

This commit is contained in:
Olof hagsand 2020-07-02 17:20:38 +02:00
commit 839dc3231d
27 changed files with 275 additions and 120 deletions

View file

@ -90,7 +90,7 @@
* If such an attribute its found, its string value is returned.
* @param[in] x XML node (where to look for attribute)
* @param[in] name Attribute name
* @param[in] namespace (Expected)Namespace of attribute
* @param[in] ns (Expected)Namespace of attribute
* @param[out] cbret Error message (if retval=0)
* @param[out] valp Pointer to value (if retval=1)
* @retval -1 Error
@ -100,7 +100,7 @@
static int
attr_ns_value(cxobj *x,
char *name,
char *namespace,
char *ns,
cbuf *cbret,
char **valp)
{
@ -119,7 +119,7 @@ attr_ns_value(cxobj *x,
goto fail;
}
/* the attribute exists, but not w expected namespace */
if (strcmp(ans, namespace) == 0)
if (strcmp(ans, ns) == 0)
val = xml_value(xa);
}
*valp = val;

View file

@ -297,7 +297,7 @@ json2xml_decode_identityref(cxobj *x,
cxobj **xerr)
{
int retval = -1;
char *namespace;
char *ns;
char *body;
cxobj *xb;
cxobj *xa;
@ -319,7 +319,7 @@ json2xml_decode_identityref(cxobj *x,
/* prefix is a module name -> find module */
if (prefix){
if ((ymod = yang_find_module_by_name(yspec, prefix)) != NULL){
namespace = yang_find_mynamespace(ymod);
ns = yang_find_mynamespace(ymod);
/* Is this namespace in the xml context?
* (yes) use its prefix (unless it is NULL)
* (no) insert a xmlns:<prefix> statement
@ -328,15 +328,15 @@ json2xml_decode_identityref(cxobj *x,
if (xml_nsctx_node(x, &nsc) < 0)
goto done;
clicon_debug(1, "%s prefix:%s body:%s namespace:%s",
__FUNCTION__, prefix, body, namespace);
if (!xml_nsctx_get_prefix(nsc, namespace, &prefix2)){
__FUNCTION__, prefix, body, ns);
if (!xml_nsctx_get_prefix(nsc, ns, &prefix2)){
/* (no) insert a xmlns:<prefix> statement
* Get yang prefix from import statement of my mod */
if (yang_find_prefix_by_namespace(y, namespace, &prefix2) == 0){
if (yang_find_prefix_by_namespace(y, ns, &prefix2) == 0){
#ifndef IDENTITYREF_KLUDGE
/* Just get the prefix from the module's own namespace */
if (xerr && netconf_unknown_namespace_xml(xerr, "application",
namespace,
ns,
"No local prefix corresponding to namespace") < 0)
goto done;
goto fail;
@ -350,7 +350,7 @@ json2xml_decode_identityref(cxobj *x,
goto done;
if (xml_prefix_set(xa, "xmlns") < 0)
goto done;
if (xml_value_set(xa, namespace) < 0)
if (xml_value_set(xa, ns) < 0)
goto done;
}
/* Here prefix2 is valid and can be NULL

View file

@ -568,14 +568,14 @@ netconf_unknown_element_xml(cxobj **xret,
int
netconf_unknown_namespace(cbuf *cb,
char *type,
char *namespace,
char *ns,
char *message)
{
int retval = -1;
cxobj *xret = NULL;
if (netconf_common_xml(&xret, type, "unknown-namespace",
"bad-namespace", namespace, message) < 0)
"bad-namespace", ns, message) < 0)
goto done;
if (clicon_xml2cbuf(cb, xret, 0, 0, -1) < 0)
goto done;
@ -589,11 +589,11 @@ netconf_unknown_namespace(cbuf *cb,
int
netconf_unknown_namespace_xml(cxobj **xret,
char *type,
char *namespace,
char *ns,
char *message)
{
return netconf_common_xml(xret, type, "unknown-namespace",
"bad-namespace", namespace, message);
"bad-namespace", ns, message);
}
/*! Create Netconf access-denied error cbuf according to RFC 6241 App A

View file

@ -672,7 +672,7 @@ static rpc_callback_t *rpc_cb_list = NULL;
* @param[in] h clicon handle
* @param[in] cb Callback called
* @param[in] arg Domain-specific argument to send to callback
* @param[in] namespace namespace of rpc
* @param[in] ns namespace of rpc
* @param[in] name RPC name
* @retval 0 OK
* @retval -1 Error
@ -682,12 +682,12 @@ int
rpc_callback_register(clicon_handle h,
clicon_rpc_cb cb,
void *arg,
char *namespace,
char *ns,
char *name)
{
rpc_callback_t *rc = NULL;
if (name == NULL || namespace == NULL){
if (name == NULL || ns == NULL){
clicon_err(OE_DB, EINVAL, "name or namespace NULL");
goto done;
}
@ -698,7 +698,7 @@ rpc_callback_register(clicon_handle h,
memset(rc, 0, sizeof(*rc));
rc->rc_callback = cb;
rc->rc_arg = arg;
rc->rc_namespace = strdup(namespace);
rc->rc_namespace = strdup(ns);
rc->rc_name = strdup(name);
ADDQ(rc, rpc_cb_list);
return 0;
@ -755,19 +755,19 @@ rpc_callback_call(clicon_handle h,
rpc_callback_t *rc;
char *name;
char *prefix;
char *namespace;
char *ns;
int nr = 0; /* How many callbacks */
if (rpc_cb_list == NULL)
return 0;
name = xml_name(xe);
prefix = xml_prefix(xe);
xml2ns(xe, prefix, &namespace);
xml2ns(xe, prefix, &ns);
rc = rpc_cb_list;
do {
if (strcmp(rc->rc_name, name) == 0 &&
namespace && rc->rc_namespace &&
strcmp(rc->rc_namespace, namespace) == 0){
ns && rc->rc_namespace &&
strcmp(rc->rc_namespace, ns) == 0){
if (rc->rc_callback(h, xe, cbret, arg, rc->rc_arg) < 0){
clicon_debug(1, "%s Error in: %s", __FUNCTION__, rc->rc_name);
goto done;
@ -804,7 +804,7 @@ static upgrade_callback_t *upgrade_cb_list = NULL;
* @param[in] cb Callback called
* @param[in] fnstr Stringified function for debug
* @param[in] arg Domain-specific argument to send to callback
* @param[in] namespace Module namespace (if NULL all modules)
* @param[in] ns Module namespace (if NULL all modules)
* @retval 0 OK
* @retval -1 Error
* @see upgrade_callback_call which makes the actual callback
@ -813,7 +813,7 @@ int
upgrade_callback_reg_fn(clicon_handle h,
clicon_upgrade_cb cb,
const char *fnstr,
char *namespace,
char *ns,
void *arg)
{
upgrade_callback_t *uc;
@ -826,8 +826,8 @@ upgrade_callback_reg_fn(clicon_handle h,
uc->uc_callback = cb;
uc->uc_fnstr = fnstr;
uc->uc_arg = arg;
if (namespace)
uc->uc_namespace = strdup(namespace);
if (ns)
uc->uc_namespace = strdup(ns);
ADDQ(uc, upgrade_cb_list);
return 0;
done:

View file

@ -238,7 +238,7 @@ validate_identityref(cxobj *xt,
* see IDENTITYREF_KLUDGE
*/
if (0){
char *namespace;
char *ns;
yang_stmt *ymod;
yang_stmt *yspec;
@ -246,11 +246,11 @@ validate_identityref(cxobj *xt,
* identityref list associated with the base identities.
*/
/* Get namespace (of idref) from xml */
if (xml2ns(xt, prefix, &namespace) < 0)
if (xml2ns(xt, prefix, &ns) < 0)
goto done;
yspec = ys_spec(ys);
/* Get module of that namespace */
if ((ymod = yang_find_module_by_namespace(yspec, namespace)) == NULL){
if ((ymod = yang_find_module_by_namespace(yspec, ns)) == NULL){
clicon_err(OE_YANG, ENOENT, "No module found");
goto done;
}
@ -1085,7 +1085,7 @@ xml_yang_validate_all(clicon_handle h,
int ret;
cxobj *x;
cxobj *xp;
char *namespace = NULL;
char *ns = NULL;
cbuf *cb = NULL;
cvec *nsc = NULL;
@ -1102,10 +1102,10 @@ xml_yang_validate_all(clicon_handle h,
cprintf(cb, "Failed to find YANG spec of XML node: %s", xml_name(xt));
if ((xp = xml_parent(xt)) != NULL)
cprintf(cb, " with parent: %s", xml_name(xp));
if (xml2ns(xt, xml_prefix(xt), &namespace) < 0)
if (xml2ns(xt, xml_prefix(xt), &ns) < 0)
goto done;
if (namespace)
cprintf(cb, " in namespace: %s", namespace);
if (ns)
cprintf(cb, " in namespace: %s", ns);
if (netconf_unknown_element_xml(xret, "application", xml_name(xt), cbuf_get(cb)) < 0)
goto done;
goto fail;

View file

@ -355,7 +355,7 @@ changelog_iterate(clicon_handle h,
/*! Automatic upgrade using changelog
* @param[in] h Clicon handle
* @param[in] xt Top-level XML tree to be updated (includes other ns as well)
* @param[in] namespace Namespace of module (for info)
* @param[in] ns Namespace of module (for info)
* @param[in] op One of XML_FLAG_ADD, _DEL, _CHANGE
* @param[in] from From revision on the form YYYYMMDD
* @param[in] to To revision on the form YYYYMMDD (0 not in system)
@ -369,7 +369,7 @@ changelog_iterate(clicon_handle h,
int
xml_changelog_upgrade(clicon_handle h,
cxobj *xt,
char *namespace,
char *ns,
uint16_t op,
uint32_t from,
uint32_t to,
@ -399,7 +399,7 @@ xml_changelog_upgrade(clicon_handle h,
* - note it t=0 then no changelog is applied
*/
if (xpath_vec(xchlog, NULL, "changelog[namespace=\"%s\"]",
&vec, &veclen, namespace) < 0)
&vec, &veclen, ns) < 0)
goto done;
/* Get all changelogs in the interval [from,to]*/
for (i=0; i<veclen; i++){
@ -487,7 +487,7 @@ clixon_xml_changelog_init(clicon_handle h)
/*! Given a top-level XML tree and a namespace, return a vector of matching XML nodes
* @param[in] h Clicon handle
* @param[in] xt Top-level XML tree, with children marked with namespaces
* @param[in] namespace The namespace to select
* @param[in] ns The namespace to select
* @param[out] vecp Vector containining XML nodes w namespace. Null-terminated.
* @param[out] veclenp Length of vector
* @note Need to free vec after use with free()
@ -500,7 +500,7 @@ clixon_xml_changelog_init(clicon_handle h)
int
xml_namespace_vec(clicon_handle h,
cxobj *xt,
char *namespace,
char *ns,
cxobj ***vecp,
size_t *veclenp)
{
@ -508,7 +508,7 @@ xml_namespace_vec(clicon_handle h,
cxobj **xvec = NULL;
size_t xlen;
cxobj *xc;
char *ns;
char *ns0;
int i;
/* Allocate upper bound on length (ie could be too large) + a NULL element
@ -523,9 +523,9 @@ xml_namespace_vec(clicon_handle h,
xc = NULL;
i = 0;
while ((xc = xml_child_each(xt, xc, CX_ELMNT)) != NULL) {
if (xml2ns(xc, NULL, &ns) < 0) /* Get namespace of XML */
if (xml2ns(xc, NULL, &ns0) < 0) /* Get namespace of XML */
goto done;
if (strcmp(namespace, ns))
if (strcmp(ns, ns0))
continue; /* no match */
xvec[i++] = xc;
}

View file

@ -933,14 +933,14 @@ add_namespace(cxobj *x,
/*! Change namespace of XML node
*
* @param[in] x XML node
* @param[in] namespace Change to this namespace (if ns does not exist in tree)
* @param[in] ns Change to this namespace (if ns does not exist in tree)
* @param[in] prefix If change, use this prefix
* @param 0 OK
* @param -1 Error
*/
int
xml_namespace_change(cxobj *x,
char *namespace,
char *ns,
char *prefix)
{
int retval = -1;
@ -951,10 +951,10 @@ xml_namespace_change(cxobj *x,
ns0 = NULL;
if (xml2ns(x, xml_prefix(x), &ns0) < 0)
goto done;
if (ns0 && strcmp(ns0, namespace) == 0)
if (ns0 && strcmp(ns0, ns) == 0)
goto ok; /* Already has right namespace */
/* Is namespace already declared? */
if (xml2prefix(x, namespace, &prefix0) == 1){
if (xml2prefix(x, ns, &prefix0) == 1){
/* Yes it is declared and the prefix is prefix0 */
if (xml_prefix_set(x, prefix0) < 0)
goto done;
@ -967,7 +967,7 @@ xml_namespace_change(cxobj *x,
xp = x;
else
xp = xml_parent(x);
if (add_namespace(x, xp, prefix, namespace) < 0)
if (add_namespace(x, xp, prefix, ns) < 0)
goto done;
/* Add prefix to x, if any */
if (prefix && xml_prefix_set(x, prefix) < 0)
@ -1279,7 +1279,7 @@ assign_namespace(cxobj *x0, /* source */
cxobj *x1, /* target */
cxobj *x1p,
int isroot,
char *namespace,
char *ns,
char *prefix0)
{
int retval = -1;
@ -1290,7 +1290,7 @@ assign_namespace(cxobj *x0, /* source */
yang_stmt *y;
/* 2a. Detect if namespace is declared in x1 target parent */
if (xml2prefix(x1p, namespace, &pexist) == 1){
if (xml2prefix(x1p, ns, &pexist) == 1){
/* Yes, and it has prefix pexist */
if (pexist){
if ((prefix1 = strdup(pexist)) == NULL){
@ -1312,12 +1312,12 @@ assign_namespace(cxobj *x0, /* source */
nscache_replace(x1, nsc);
}
/* Just in case */
if (nscache_set(x1, prefix1, namespace) < 0)
if (nscache_set(x1, prefix1, ns) < 0)
goto done;
}
else{ /* No, namespace does not exist in x1 _parent_
* Check if it is exists in x1 itself */
if (xml2prefix(x1, namespace, &pexist) == 1){
if (xml2prefix(x1, ns, &pexist) == 1){
/* Yes it exists, but is it equal? */
if (clicon_strcmp(pexist, prefix0) == 0)
; /* Equal, reuse */
@ -1345,7 +1345,7 @@ assign_namespace(cxobj *x0, /* source */
goto done;
}
/* Find local (imported) prefix for that module namespace */
if (yang_find_prefix_by_namespace(y, namespace, &ptmp) < 0)
if (yang_find_prefix_by_namespace(y, ns, &ptmp) < 0)
goto done;
if ((prefix1 = strdup(ptmp)) == NULL){
clicon_err(OE_UNIX, errno, "strdup");
@ -1354,7 +1354,7 @@ assign_namespace(cxobj *x0, /* source */
}
}
if (add_namespace(x1, x1, prefix1, namespace) < 0)
if (add_namespace(x1, x1, prefix1, ns) < 0)
goto done;
if (prefix1 && xml_prefix_set(x1, prefix1) < 0)
goto done;

View file

@ -71,7 +71,7 @@
/*! Create and initialize XML namespace context
* @param[in] prefix Namespace prefix, or NULL for default
* @param[in] namespace Set this namespace. If NULL create empty nsctx
* @param[in] ns Set this namespace. If NULL create empty nsctx
* @retval nsc Return namespace context in form of a cvec
* @retval NULL Error
* @code
@ -86,7 +86,7 @@
*/
cvec *
xml_nsctx_init(char *prefix,
char *namespace)
char *ns)
{
cvec *cvv = NULL;
@ -94,7 +94,7 @@ xml_nsctx_init(char *prefix,
clicon_err(OE_XML, errno, "cvec_new");
goto done;
}
if (namespace && xml_nsctx_add(cvv, prefix, namespace) < 0)
if (ns && xml_nsctx_add(cvv, prefix, ns) < 0)
goto done;
done:
return cvv;
@ -143,15 +143,15 @@ xml_nsctx_get(cvec *cvv,
*/
int
xml_nsctx_get_prefix(cvec *cvv,
char *namespace,
char *ns,
char **prefix)
{
cg_var *cv = NULL;
char *ns = NULL;
char *ns0 = NULL;
while ((cv = cvec_each(cvv, cv)) != NULL){
if ((ns = cv_string_get(cv)) != NULL &&
strcmp(ns, namespace) == 0){
if ((ns0 = cv_string_get(cv)) != NULL &&
strcmp(ns0, ns) == 0){
if (prefix)
*prefix = cv_name_get(cv); /* can be NULL */
return 1;
@ -165,22 +165,22 @@ xml_nsctx_get_prefix(cvec *cvv,
/*! Set or replace namespace in namespace context
* @param[in] cvv Namespace context
* @param[in] prefix Namespace prefix, or NULL for default
* @param[in] namespace Cached namespace to set (assume non-null?)
* @param[in] ns Cached namespace to set (assume non-null?)
* @retval 0 OK
* @retval -1 Error
*/
int
xml_nsctx_add(cvec *cvv,
char *prefix,
char *namespace)
char *ns)
{
int retval = -1;
cg_var *cv;
if ((cv = cvec_find(cvv, prefix)) != NULL) /* found, replace that */
cv_string_set(cv, namespace);
cv_string_set(cv, ns);
else /* cvec exists, but not prefix */
cvec_add_string(cvv, prefix, namespace);
cvec_add_string(cvv, prefix, ns);
retval = 0;
// done:
return retval;

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:

View file

@ -518,7 +518,7 @@ ys_cp(yang_stmt *ynew,
/*! Create a new yang node and copy the contents recursively from the original. *
* @param[in] old Old existing yang statement (from)
* @retval NULL Error
* @retval new New created yang statement
* @retval nw New created yang statement
* This may involve duplicating strings, etc.
* The new yang tree needs to be freed by ys_free().
* The parent of new is NULL, it needs to be explicityl inserted somewhere
@ -526,19 +526,19 @@ ys_cp(yang_stmt *ynew,
yang_stmt *
ys_dup(yang_stmt *old)
{
yang_stmt *new;
yang_stmt *nw;
if ((new = ys_new(old->ys_keyword)) == NULL)
if ((nw = ys_new(old->ys_keyword)) == NULL)
return NULL;
if (new->ys_cvec){
cvec_free(new->ys_cvec);
new->ys_cvec = NULL;
if (nw->ys_cvec){
cvec_free(nw->ys_cvec);
nw->ys_cvec = NULL;
}
if (ys_cp(new, old) < 0){
ys_free(new);
if (ys_cp(nw, old) < 0){
ys_free(nw);
return NULL;
}
return new;
return nw;
}
/*! Append yang statement as child of a parent yang_statement, last in list
@ -849,7 +849,7 @@ yang_find_myprefix(yang_stmt *ys)
/*! Given a yang statement, find the namespace URI associated to this module
* @param[in] ys Yang statement in module tree (or module itself)
* @retval NULL Not found
* @retval namespace Namspace URI as char* pointer into yang tree
* @retval ns Namspace URI as char* pointer into yang tree
* @code
* char *myns = yang_find_mynamespace(ys);
* @endcode
@ -860,7 +860,7 @@ yang_find_mynamespace(yang_stmt *ys)
{
yang_stmt *ymod; /* My module */
yang_stmt *ynamespace;
char *namespace = NULL;
char *ns = NULL;
if ((ymod = ys_real_module(ys)) == NULL){
clicon_err(OE_YANG, ENOENT, "My yang module not found");
@ -868,9 +868,9 @@ yang_find_mynamespace(yang_stmt *ys)
}
if ((ynamespace = yang_find(ymod, Y_NAMESPACE, NULL)) == NULL)
goto done;
namespace = yang_argument_get(ynamespace);
ns = yang_argument_get(ynamespace);
done:
return namespace;
return ns;
}
/*! Given a yang statement and namespace, find local prefix valid in module
@ -878,7 +878,7 @@ yang_find_mynamespace(yang_stmt *ys)
* (global) namespace of a module, but you do not know the local prefix
* used to access it in XML.
* @param[in] ys Yang statement in module tree (or module itself)
* @param[in] namespace Namspace URI as char* pointer into yang tree
* @param[in] ns Namspace URI as char* pointer into yang tree
* @param[out] prefix Local prefix to access module with (direct pointer)
* @retval 0 not found
* @retval -1 found
@ -891,7 +891,7 @@ yang_find_mynamespace(yang_stmt *ys)
*/
int
yang_find_prefix_by_namespace(yang_stmt *ys,
char *namespace,
char *ns,
char **prefix)
{
int retval = 0; /* not found */
@ -906,13 +906,13 @@ yang_find_prefix_by_namespace(yang_stmt *ys,
clicon_debug(1, "%s", __FUNCTION__);
/* First check if namespace is my own module */
myns = yang_find_mynamespace(ys);
if (strcmp(myns, namespace) == 0){
if (strcmp(myns, ns) == 0){
*prefix = yang_find_myprefix(ys); /* or NULL? */
goto found;
}
/* Next, find namespaces in imported modules */
yspec = ys_spec(ys);
if ((ymod = yang_find_module_by_namespace(yspec, namespace)) == NULL)
if ((ymod = yang_find_module_by_namespace(yspec, ns)) == NULL)
goto notfound;
modname = yang_argument_get(ymod);
my_ymod = ys_module(ys);
@ -1132,18 +1132,18 @@ ys_module_by_xml(yang_stmt *yspec,
int retval = -1;
yang_stmt *ym = NULL; /* module */
char *prefix = NULL;
char *namespace = NULL; /* namespace URI */
char *ns = NULL; /* namespace URI */
if (ymodp)
*ymodp = NULL;
prefix = xml_prefix(xt);
if (xml2ns(xt, prefix, &namespace) < 0) /* prefix may be NULL */
if (xml2ns(xt, prefix, &ns) < 0) /* prefix may be NULL */
goto done;
/* No namespace found, give up */
if (namespace == NULL)
if (ns == NULL)
goto ok;
/* We got the namespace, now get the module */
ym = yang_find_module_by_namespace(yspec, namespace);
ym = yang_find_module_by_namespace(yspec, ns);
/* Set result param */
if (ymodp && ym)
*ymodp = ym;

View file

@ -555,7 +555,7 @@ yang_find_module_by_prefix_yspec(yang_stmt *yspec,
/*! Given a yang spec and a namespace, return yang module
*
* @param[in] yspec A yang specification
* @param[in] namespace namespace
* @param[in] ns namespace
* @retval ymod Yang module statement if found
* @retval NULL not found
* @see yang_find_module_by_name
@ -563,14 +563,14 @@ yang_find_module_by_prefix_yspec(yang_stmt *yspec,
*/
yang_stmt *
yang_find_module_by_namespace(yang_stmt *yspec,
char *namespace)
char *ns)
{
yang_stmt *ymod = NULL;
if (namespace == NULL)
if (ns == NULL)
goto done;
while ((ymod = yn_each(yspec, ymod)) != NULL) {
if (yang_find(ymod, Y_NAMESPACE, namespace) != NULL)
if (yang_find(ymod, Y_NAMESPACE, ns) != NULL)
break;
}
done: