From 6fedf65de74be835ad7b4e37972d57354fc7588f Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Thu, 29 Dec 2022 15:45:16 +0100 Subject: [PATCH] C-API: Changed type of `veclen` parameter to `size_t` in `xpath_vec_flag()` Rewrite of sed -e to be portable to freebsd --- CHANGELOG.md | 1 + apps/backend/backend_commit.c | 3 +-- example/main/example_backend.c | 2 +- lib/clixon/clixon_xpath.h | 2 +- lib/src/clixon_event.c | 11 +++++++---- lib/src/clixon_xml_default.c | 1 + lib/src/clixon_xpath.c | 10 ++++++---- test/test_netconf_monitoring.sh | 7 +++++-- 8 files changed, 23 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c6c6da5..023024ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -72,6 +72,7 @@ Developers may need to change their code * Added netconf ssh subsystem * Renamed from `clixon` built in `docker/base` * C-API + * Changed type of `veclen` parameter to `size_t` in `xpath_vec_flag()` * Added `with-defaults` parameter (default 0) to `xmldb_get0()` * Added `sock_flags` parameter to `clixon_proc_socket()` diff --git a/apps/backend/backend_commit.c b/apps/backend/backend_commit.c index c1a41aea..8e9629d1 100644 --- a/apps/backend/backend_commit.c +++ b/apps/backend/backend_commit.c @@ -637,7 +637,6 @@ candidate_validate(clicon_handle h, goto done; } - /*! Do a diff between candidate and running, then start a commit transaction * * The code reverts changes if the commit fails. But if the revert @@ -646,7 +645,7 @@ candidate_validate(clicon_handle h, * @param[in] h Clicon handle * @param[in] xe Request: (or NULL) * @param[in] db A candidate database, not necessarily "candidate" - * @param[out] cbret Return xml tree, eg ..., ..., xc_type == XT_NODESET){ for (i=0; ixc_size; i++){ + int ilen; x = xr->xc_nodeset[i]; if (flags==0x0 || xml_flag(x, flags)) - if (cxvec_append(x, vec, veclen) < 0) + if (cxvec_append(x, vec, &ilen) < 0) goto done; } } + *veclen = ilen; retval = 0; done: if (xr) diff --git a/test/test_netconf_monitoring.sh b/test/test_netconf_monitoring.sh index 2455ce40..fa1c3afa 100755 --- a/test/test_netconf_monitoring.sh +++ b/test/test_netconf_monitoring.sh @@ -171,9 +171,12 @@ EOF continue fi # Mask netconf header and footer - sed -i -e "s///" -e 's/<\/data><\/rpc-reply>]]>]]>//' /var/tmp/test_netconf_monitoring.sh/ex.yang + sed -i -e "s///" /var/tmp/test_netconf_monitoring.sh/ex.yang + sed -i -e 's/<\/data><\/rpc-reply>]]>]]>//' /var/tmp/test_netconf_monitoring.sh/ex.yang # Decode XML - sed -i -e 's/>/>/g' -e 's/<//g' /var/tmp/test_netconf_monitoring.sh/ex.yang + sed -i -e 's/</