[libxml2] Remove unreachable code in xmlXPathCountFunction
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Remove unreachable code in xmlXPathCountFunction
- Date: Thu, 25 Apr 2019 09:56:26 +0000 (UTC)
commit f75256e7db7728a6f6cf519955319ed6ef7797ed
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Tue Apr 23 17:23:39 2019 +0200
Remove unreachable code in xmlXPathCountFunction
After the initial test, the condition
(type == XPATH_NODESET) || (type == XPATH_XSLT_TREE)
always holds true.
xpath.c | 21 +--------------------
1 file changed, 1 insertion(+), 20 deletions(-)
---
diff --git a/xpath.c b/xpath.c
index d15fd8bb..30e9959a 100644
--- a/xpath.c
+++ b/xpath.c
@@ -8508,28 +8508,9 @@ xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs) {
if ((cur == NULL) || (cur->nodesetval == NULL))
valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, (double) 0));
- else if ((cur->type == XPATH_NODESET) || (cur->type == XPATH_XSLT_TREE)) {
+ else
valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context,
(double) cur->nodesetval->nodeNr));
- } else {
- if ((cur->nodesetval->nodeNr != 1) ||
- (cur->nodesetval->nodeTab == NULL)) {
- valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, (double) 0));
- } else {
- xmlNodePtr tmp;
- int i = 0;
-
- tmp = cur->nodesetval->nodeTab[0];
- if ((tmp != NULL) && (tmp->type != XML_NAMESPACE_DECL)) {
- tmp = tmp->children;
- while (tmp != NULL) {
- tmp = tmp->next;
- i++;
- }
- }
- valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, (double) i));
- }
- }
xmlXPathReleaseObject(ctxt->context, cur);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]