diff --git a/CHANGELOG.md b/CHANGELOG.md index 25ab2ec3..ef465001 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,7 @@ Users may have to change how they access the system ### Corrected Bugs +* Fixed: [xpath function count did not work properly #224](https://github.com/clicon/clixon/issues/224) * Fixed: RESTCONF Native: Failed binding of socket in network namespace caused process zombie * Fixed problems with XPATH composite operations and functions in netconf get/get-config operations. * See [XPATH issues #219](https://github.com/clicon/clixon/issues/219) diff --git a/apps/restconf/restconf_main_native.c b/apps/restconf/restconf_main_native.c index 65e54458..d5017767 100644 --- a/apps/restconf/restconf_main_native.c +++ b/apps/restconf/restconf_main_native.c @@ -1028,7 +1028,6 @@ restconf_connection(int s, clicon_handle h; int readmore = 1; restconf_conn_h *rc; - cbuf *cberr = NULL; clicon_debug(1, "%s", __FUNCTION__); if ((conn = (evhtp_connection_t*)arg) == NULL){ @@ -1139,8 +1138,6 @@ restconf_connection(int s, retval = 0; done: clicon_debug(1, "%s retval %d", __FUNCTION__, retval); - if (cberr) - cbuf_free(cberr); return retval; } diff --git a/lib/src/clixon_xpath_function.c b/lib/src/clixon_xpath_function.c index 81b8ac54..f930413d 100644 --- a/lib/src/clixon_xpath_function.c +++ b/lib/src/clixon_xpath_function.c @@ -441,7 +441,7 @@ xp_function_count(xp_ctx *xc, } memset(xr, 0, sizeof(*xr)); xr->xc_type = XT_NUMBER; - xr->xc_number = xr0->xc_number; + xr->xc_number = xr0->xc_size; *xrp = xr; retval = 0; done: diff --git a/test/test_xpath.sh b/test/test_xpath.sh index 47be4e2e..479666ec 100755 --- a/test/test_xpath.sh +++ b/test/test_xpath.sh @@ -221,6 +221,11 @@ expectpart "$($clixon_util_xpath -f $xml3 -p "/bbb/ccc/self::node()")" 0 "nodese new "xpath nodetest: comment nyi" expectpart "$($clixon_util_xpath -f $xml3 -l o -p "/descendant-or-self::comment()")" 255 "XPATH function \"comment\" is not implemented" +# Count + +new "find bbb with 3 ccc children using count" +expectpart "$($clixon_util_xpath -f $xml3 -l o -p "(/bbb[count(ccc)=3])")" 0 "foo42bar" + # Negative new "xpath dontexist"