Fixed: [Defaults in choice does not work properly](https://github.com/clicon/clixon/issues/390)

C: Added new file clixon_xml_default.[ch] and moved all default handling there
This commit is contained in:
Olof hagsand 2022-12-22 09:15:10 +01:00
parent 7e92f67f4f
commit ffe918dd0e
16 changed files with 1015 additions and 667 deletions

View file

@ -77,6 +77,7 @@
#include "clixon_yang_module.h"
#include "clixon_xml_nsctx.h"
#include "clixon_xml_io.h"
#include "clixon_xml_default.h"
#include "clixon_xml_map.h"
#include "clixon_datastore.h"
#include "clixon_datastore_write.h"
@ -336,30 +337,6 @@ check_when_condition(cxobj *x0p,
goto done;
}
/*! Get cloxest yang case and choice, if any
*/
static int
choice_case_get(yang_stmt *yc,
yang_stmt **ycase,
yang_stmt **ychoice)
{
yang_stmt *yp;
if ((yp = yang_parent_get(yc)) == NULL)
return 0;
if (yang_keyword_get(yp) == Y_CASE){
*ycase = yp;
*ychoice = yang_parent_get(yp);
return 1;
}
else if (yang_keyword_get(yp) == Y_CHOICE){
*ycase = NULL;
*ychoice = yp;
return 1;
}
return 0;
}
/*! Check if x0/y0 is part of other choice/case than y1 recursively , if so purge
* @retval 0 No, y0 it is not in other case than y1
* @retval 1 yes, y0 is in other case than y1