aboutsummaryrefslogtreecommitdiffstats
path: root/xpath.c
Commit message (Collapse)AuthorAgeFilesLines
* space and tabs cleanup DanielDaniel Veillard2008-07-291-396/+396
| | | | | | | * xpath.c: space and tabs cleanup Daniel svn path=/trunk/; revision=3756
* two patches from Alvaro Herrera to avoid problem when running out ofDaniel Veillard2008-04-011-3/+29
| | | | | | | | * xpath.c: two patches from Alvaro Herrera to avoid problem when running out of memory in XPath evaluations. Daniel svn path=/trunk/; revision=3721
* fixed mlXPathCompOpEvalPositionalPredicate problem with object cachingWilliam M. Brack2007-08-231-1/+8
| | | | | | | * xpath.c: fixed mlXPathCompOpEvalPositionalPredicate problem with object caching (bug #469410) svn path=/trunk/; revision=3653
* fixed problem in previous fix to xmlXPathNodeSetSortWilliam M. Brack2007-06-131-6/+2
| | | | | | * xpath.c: fixed problem in previous fix to xmlXPathNodeSetSort svn path=/trunk/; revision=3640
* fixed problem with xmlXPathNodeSetSort; fixed problem withWilliam M. Brack2007-06-061-1/+7
| | | | | | | * xpath.c: fixed problem with xmlXPathNodeSetSort; fixed problem with xmlXPathNodeTrailingSorted (both bug#413451) svn path=/trunk/; revision=3622
* fixed problem with string value for PI node (bug #442275)William M. Brack2007-05-311-1/+4
| | | | | | | * xpath.c: fixed problem with string value for PI node (bug #442275) svn path=/trunk/; revision=3621
* fixed problem on gzip streams (bug #438045) fixed minor spot of redundantWilliam M. Brack2007-05-151-2/+1
| | | | | | | * nanohttp.c: fixed problem on gzip streams (bug #438045) * xpath.c: fixed minor spot of redundant code - no logic change. svn path=/trunk/; revision=3616
* enhanced the coding for xmlXPathCastNumberToString in order to produce theWilliam M. Brack2007-05-111-12/+22
| | | | | | | | * xpath.c: enhanced the coding for xmlXPathCastNumberToString in order to produce the required number of significant digits (bug #437179) svn path=/trunk/; revision=3615
* fixed xmlXPathCmpNodes for incorrect result on certain cases whenWilliam M. Brack2007-03-071-0/+3
| | | | | | | | * xpath.c: fixed xmlXPathCmpNodes for incorrect result on certain cases when comparing identical nodes (bug 415567) with patch from Oleg Paraschenko svn path=/trunk/; revision=3587
* Fixed memory bug with invalid function reported by Francois Delyon onWilliam M. Brack2007-02-141-8/+6
| | | | | | * xpath.c: Fixed memory bug with invalid function reported by Francois Delyon on mailing list svn path=/trunk/; revision=3584
* added checks for alloc fail on calls to xmlXPathNewContext (libxslt bugWilliam M. Brack2007-01-241-0/+6
| | | | | | | * xpath.c: added checks for alloc fail on calls to xmlXPathNewContext (libxslt bug #400242) svn path=/trunk/; revision=3575
* fixed a bug where the principal node type of an axis wasn't tested on nameDaniel Veillard2006-11-231-0/+11
| | | | | | * xpath.c: fixed a bug where the principal node type of an axis wasn't tested on name check, fixes bug #377432 daniel
* William spotted an obvious bug DanielDaniel Veillard2006-10-261-1/+1
| | | | | * xpath.c: William spotted an obvious bug Daniel
* applied patch from Olaf Walkowiak which should fix #334104 DanielDaniel Veillard2006-10-171-1/+1
| | | | | * xpath.c: applied patch from Olaf Walkowiak which should fix #334104 Daniel
* Applied the proposed fix for the documentation of xmlXPathCastToString();Kasimier T. Buchcik2006-08-151-3/+2
| | | | | * xpath.c: Applied the proposed fix for the documentation of xmlXPathCastToString(); see bug #346202.
* Changed xmlXPathCollectAndTest() to use xmlXPathNodeSetAddNs() when addingKasimier T. Buchcik2006-07-031-1/+4
| | | | | | | | | * xpath.c: Changed xmlXPathCollectAndTest() to use xmlXPathNodeSetAddNs() when adding a ns-node in case of NODE_TEST_TYPE (the ns-node was previously added plainly to the list). Since for NODE_TEST_ALL and NODE_TEST_NAME this specialized ns-addition function was already used, I assume it was missed to be used with NODE_TEST_TYPE.
* Fixed a double-free in xmlXPathCompOpEvalToBoolean(), revealed by aKasimier T. Buchcik2006-06-291-2/+4
| | | | | * xpath.c: Fixed a double-free in xmlXPathCompOpEvalToBoolean(), revealed by a Libxslt regression test.
* Enhanced xmlXPathCompOpEvalToBoolean() to be also usable outside predicateKasimier T. Buchcik2006-06-291-36/+36
| | | | | | | * xpath.c: Enhanced xmlXPathCompOpEvalToBoolean() to be also usable outside predicate evaluation; the intention is to use it via xmlXPathCompiledEvalToBoolean() for XSLT tests, like in <xsl:if test="/foo">.
* Fix a memory leak which occurred when usingKasimier T. Buchcik2006-06-281-5/+13
| | | | | * xpath.c: Fix a memory leak which occurred when using xmlXPathCompiledEvalToBoolean().
* Added xmlXPathCompiledEvalToBoolean() to the API and adjusted/addedKasimier T. Buchcik2006-06-261-168/+378
| | | | | | | | * xpath.c: Added xmlXPathCompiledEvalToBoolean() to the API and adjusted/added xmlXPathRunEval(), xmlXPathRunStreamEval(), xmlXPathCompOpEvalToBoolean(), xmlXPathNodeCollectAndTest() to be aware of a boolean result request. The new function is now used to evaluate predicates.
* Fixed an bug in xmlXPathCompExprAdd(): the newly introduced fieldKasimier T. Buchcik2006-06-261-0/+1
| | | | | | | | | | | | * xpath.c: Fixed an bug in xmlXPathCompExprAdd(): the newly introduced field @rewriteType on xmlXPathStepOp was not initialized to zero here; this could lead to the activation of the axis rewrite code in xmlXPathNodeCollectAndTest() when @rewriteType is randomly set to the value 1. A test (hardcoding the intial value to 1) revealed that the resulting incorrect behaviour is similar to the behaviour as described by Arnold Hendriks on the mailing list; so I hope that will fix the issue.
* Fixed an error in xmlXPathEvalExpr(), which was introduced with theKasimier T. Buchcik2006-06-231-6/+13
| | | | | | | | | | * xpath.c: Fixed an error in xmlXPathEvalExpr(), which was introduced with the addition of the d-o-s rewrite and made xpath.c unable to compile if XPATH_STREAMING was not defined (reported by Kupriyanov Anatolij - #345752). Fixed the check for d-o-s rewrite to work on the correct XPath string, which is ctxt->base and not comp->expr in this case.
* Added optimization for positional predicates (only short-hand form "[n]"),Kasimier T. Buchcik2006-06-191-762/+1030
| | | | | | * xpath.c: Added optimization for positional predicates (only short-hand form "[n]"), which have a preceding predicate: "/foo[descendant::bar][3]".
* Fixed self-invented a segfault in xmlXPathCtxtCompile(), when theKasimier T. Buchcik2006-06-061-7/+8
| | | | | | * xpath.c: Fixed self-invented a segfault in xmlXPathCtxtCompile(), when the expression was not valid and @comp was NULL and I tried to do the d-o-s rewrite.
* Enabled the compound traversal again; I added a check to use this only ifKasimier T. Buchcik2006-06-061-5/+8
| | | | | | | | | * xpath.c: Enabled the compound traversal again; I added a check to use this only if the have an expression starting with the document node; so in the case of "//foo", we already know at compilation-time, that there will be only 1 initial context node. Added the rewrite also to xmlXPathEvalExpr().
* Disabled the compound traversal for the release; I need first to assureKasimier T. Buchcik2006-06-021-3/+4
| | | | | | * xpath.c: Disabled the compound traversal for the release; I need first to assure that this is done only if we have 1 initial node.
* fixed memory leak in xpath error reportingAleksey Sanin2006-05-311-8/+12
| | | | * xpath.c: fixed memory leak in xpath error reporting
* Changed the name of the recently added public functionKasimier T. Buchcik2006-05-311-77/+84
| | | | | | | | | * xpath.c include/libxml/xpath.h runsuite.c: Changed the name of the recently added public function xmlXPathContextSetObjectCache() to xmlXPathContextSetCache(); so a more generic one, in case we decide to cache more things than only XPath objects.
* Optimized xmlXPathNodeCollectAndTest() and xmlXPathNodeCollectAndTestNth()Kasimier T. Buchcik2006-05-301-200/+481
| | | | | | | | | | | | | | | | | * xpath.c: Optimized xmlXPathNodeCollectAndTest() and xmlXPathNodeCollectAndTestNth() to evaluate a compound traversal of 2 axes when we have a "//foo" expression. This is done with a rewrite of the XPath AST in xmlXPathRewriteDOSExpression(); I added an additional field to xmlXPathStepOp for this (but the field's name should be changed). The mechanism: the embracing descendant-or-self axis traversal (also optimized to return only nodes which can hold elements), will produce context nodes for the inner traversal of the child axis. This way we avoid a full node-collecting traversal of the descendant-or-self axis. Some tests indicate that this can reduce execution time of "//foo" to 50%. Together with the XPath object cache this all significantly speeds up libxslt.
* Enhanced xmlXPathNodeCollectAndTest() to avoid recreation (if possible) ofKasimier T. Buchcik2006-05-301-42/+168
| | | | | | | | | | | | * xpath.c: Enhanced xmlXPathNodeCollectAndTest() to avoid recreation (if possible) of the node-set which is used to collect the nodes in the current axis for the currect context node. Especially for "//foo" this will decrease dramatically the number of created node-sets, since for each node in the result node-set of the evaluation of descendant-or-self::node() a new temporary node-set was created. Added node iterator xmlXPathNextChildElement() as a tiny optimization for child::foo.
* Added an XPath object cache. It sits on an xmlXPathContext and need to beKasimier T. Buchcik2006-05-291-282/+1776
| | | | | | | | | | | | | | | | | | * xpath.c include/libxml/xpath.h: Added an XPath object cache. It sits on an xmlXPathContext and need to be explicitely activated (or deactivated again) with xmlXPathContextSetObjectCache(). The cache consists of 5 lists for node-set, string, number, boolean and misc XPath objects. Internally the xpath.c module will use object- deposition and -acquisition functions which will try to reuse as many XPath objects as possible, and fallback to normal free/create behaviour if no cache is available or if the cache is full. * runsuite.c: Adjusted to deactivate the cache for XML Schema tests if a cache-creation is turned on by default for the whole library, e.g. for testing purposes of the cache. It is deactivated here in order to avoid confusion of the memory leak detection in runsuite.c.
* Removed a memcpy if xmlXPathNodeSetMerge(); it seems we really need toKasimier T. Buchcik2006-05-241-9/+20
| | | | | | | | | | | | | | | | | | | * xpath.c: Removed a memcpy if xmlXPathNodeSetMerge(); it seems we really need to walk the whole list, since those nastly namespace nodes need to be added with xmlXPathNodeSetDupNs(); thus a pure memcpy is not possible. A flag on the node-set indicating if namespace nodes are in the set would help here; this is the 3rd flag which would be usefull with node-sets. The current flags I have in mind: 1) Is a node-set already sorted? This would allow for rebust and optimizable sorting behaviour. 2) Of what type are the nodes in the set (or of mixed type)? This would allow for faster merging of node-sets. 3) Are namespace nodes in the set? This would allow to skipp all the namespace node specific special handling. Faster node-set merging if the first set is empty; just memcpy the set.
* Optimization of count(): eliminated sorting (see bug #165547).Kasimier T. Buchcik2006-05-221-39/+449
| | | | | | | * xpath.c: Optimization of count(): eliminated sorting (see bug #165547). Optimization of XPATH_OP_FILTER if the predicate is a [1] (disable with XP_OPTIMIZED_FILTER_FIRST if it produces trouble). Tiny opt in xmlXPathNodeSetMerge().
* Substituted all remaining calls to xmlXPathCmpNodes() forKasimier T. Buchcik2006-05-191-22/+54
| | | | | | | | | * xpath.c: Substituted all remaining calls to xmlXPathCmpNodes() for xmlXPathCmpNodesExt(). Tiny further enhancement of xmlXPathCmpNodesExt(). Added additional checks in various code parts to avoid calling sorting or merging functions if the node-set(s) don't need them; i.e., if they are empty or contain just one node.
* Optimized the comparison for non-element nodes in xmlXPathCmpNodesExt();Kasimier T. Buchcik2006-05-191-1/+296
| | | | | | | | | | * xpath.c: Optimized the comparison for non-element nodes in xmlXPathCmpNodesExt(); the comparison is used for sorting of node-sets. This enhancement is related to bug #165547. There are other places where the old comparison function xmlXPathCmpNodes() is still called, but I currently don't know exactly what those calls are for; thus if they can be substituted (if it makes sense) for the new function.
* Applied patch from Rob Richards, fixing a potential memory leak inKasimier T. Buchcik2006-05-161-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | * xpath.c: Applied patch from Rob Richards, fixing a potential memory leak in xmlXPathTryStreamCompile(), when a list of namespaces was assigned to the XPath compilation context; here a new namespace list was created and passed to xmlPatterncompile(); but this list was not freed afterwards. Additionally we avoid now in xmlXPathTryStreamCompile() to compile the expression, if it has a colon - indicating prefixed name tests - and no namespace list was given. The streaming XPath mechanism needs a namespace list at compilation time (unlike normal XPath, where we can bind namespace names to prefixes at execution time). * pattern.c: Enhanced to use a string dict for local-names, ns-prefixes and and namespace-names. Fixed xmlStreamPushInternal() not to use string-pointer comparison if a dict is available; this won't work, since one does not know it the given strings originate from the same dict - and they normally don't do, since e.g. namespaces are hold on xmlNs->href. I think this would be worth an investigation: if we can add a @doc field to xmlNs and put the @href in to a additionan namespace dict hold in xmlDoc. Daniel will surely not like this idea :-) But evaluation of tons of elements/attributes in namespaces with xmlStrEqual() isn't the way we should go forever.
* fix a few warning raised by gcc-4.1 and latests changes DanielDaniel Veillard2006-03-101-4/+2
| | | | | | * c14n.c encoding.c xmlschemas.c xpath.c xpointer.c: fix a few warning raised by gcc-4.1 and latests changes Daniel
* end of first pass on coverity reports. DanielDaniel Veillard2006-03-101-11/+11
| | | | | | | * runtest.c schematron.c testAutomata.c tree.c valid.c xinclude.c xmlcatalog.c xmlreader.c xmlregexp.c xpath.c: end of first pass on coverity reports. Daniel
* workaround HP-UX compiler bug by Rick Jones DanielDaniel Veillard2006-02-271-1/+1
| | | | | * xpath.c: workaround HP-UX compiler bug by Rick Jones Daniel
* Fixed bug #322928, reported by Erich Schubert: The bug was in pattern.c,Kasimier T. Buchcik2006-01-051-24/+73
| | | | | | | | | | | | | * pattern.c xpath.c include/libxml/pattern.h: Fixed bug #322928, reported by Erich Schubert: The bug was in pattern.c, which is used for a tiny subset of xpath expression which can be evaluated in an optimized way. The doc-node was never considered when evaluating "//" expressions. Additionally, we fixed resolution to nodes of any type in pattern.c; i.e. a "//." didn't work yet, as it did select only element-nodes. Due to this issue the pushing of nodes in xpath.c needed to be adjusted as well.
* prepare for release work for #303289, fix a formatting bug for MIN_INTDaniel Veillard2005-09-041-13/+7
| | | | | | * configure.in doc/* configure.in: prepare for release * xpath.c: work for #303289, fix a formatting bug for MIN_INT Daniel
* fixing yet another pattern induced XPath bug #314282 reverted back lastDaniel Veillard2005-09-041-6/+16
| | | | | | | * pattern.c xpath.c include/libxml/pattern.h: fixing yet another pattern induced XPath bug #314282 * relaxng.c: reverted back last change it was seriously broken Daniel
* removed a potentially uninitialized variable error fixed a deprecationDaniel Veillard2005-08-241-0/+2
| | | | | | | * xpath.c: removed a potentially uninitialized variable error * python/generator.py: fixed a deprecation warning * python/tests/tstLastError.py: silent the damn test when Okay ! Daniel
* a lot of small cleanups based on Linus' sparse check output. DanielDaniel Veillard2005-07-281-16/+25
| | | | | | | | | * HTMLparser.c SAX2.c encoding.c globals.c parser.c relaxng.c runsuite.c runtest.c schematron.c testHTML.c testReader.c testRegexp.c testSAX.c testThreads.c valid.c xinclude.c xmlIO.c xmllint.c xmlmodule.c xmlschemas.c xpath.c xpointer.c: a lot of small cleanups based on Linus' sparse check output. Daniel
* changed xmlPatterncompile signature to pass an int and not an enum sinceDaniel Veillard2005-07-231-0/+6
| | | | | | | | | | | | | | | * pattern.c include/libxml/pattern.h: changed xmlPatterncompile signature to pass an int and not an enum since it can generate ABI compat troubles. * include/libxml/schematron.h schematron.c: adding the new schematron code, work in progress lots to be left and needing testing * include/libxml/xmlversion.h.in include/libxml/xmlwin32version.h.in Makefile.am configure.in: integration of schematron into the build * xpath.c include/libxml/xpath.h: adding flags to control compilation options right now just XML_XPATH_CHECKNS. Daniel
* Changed the behaviour of xmlXPathEqualNodeSetFloat to return TRUE if aWilliam M. Brack2005-07-141-0/+3
| | | | | | * xpath.c: Changed the behaviour of xmlXPathEqualNodeSetFloat to return TRUE if a nodeset with a numeric value of NaN is compared for inequality with any numeric value (bug 309914).
* preparing to make testsuite releases along with code source releases fixedDaniel Veillard2005-07-101-0/+10
| | | | | | | | | | | | | * xstc/Makefile.am README README.tests Makefile.tests Makefile.am: preparing to make testsuite releases along with code source releases * gentest.py testapi.c: fixed a couple of problem introduced by the new Schemas support for Readers * xpath.c: fixed the XPath attribute:: bug #309580, #309864 in a crude but simple way. * xmlschemas.c include/libxml/tree.h: fixed a couple of problems raised by the doc builder. * doc/*: made rebuild Daniel
* Further enhancement for XPath streaming, consolidated with schemas usageWilliam M. Brack2005-06-091-1/+2
| | | | | | | | | | | | * pattern.c, xpath.c, include/libxml/pattern.h: Further enhancement for XPath streaming, consolidated with schemas usage of pattern.c. Added a new enum xmlPatternFlags. * doc/*, testapi.c, elfgcchack.h: updated to reflect new enum. * test/XPath/tests/mixedpat, test/XPath/docs/mixed, result/XPath/mixedpat: added regression test for problems reported in bug306348
* Enhanced xmlXPathRunStreamEval, fixed handling of depth/level for casesWilliam M. Brack2005-06-061-1/+8
| | | | | | | | | * xpath.c, pattern.c: Enhanced xmlXPathRunStreamEval, fixed handling of depth/level for cases like union operator (bug #306348 reported by Bob Stayton). Also enhanced several comments throughout pattern.c. * doc/apibuild.py: fixed problem in handling of 'signed' declaration. Rebuilt the docs.
* on linux/gcc use weak definitions to avoid linking with pthread library onDaniel Veillard2005-05-041-1/+1
| | | | | | | | * Makefile.am configure.in threads.c: on linux/gcc use weak definitions to avoid linking with pthread library on non-threaded environments. * xpath.c: applied patch from Mark Vakoc w.r.t. a buggy namespace list allocation. Daniel