summaryrefslogtreecommitdiff
path: root/pattern.c
Commit message (Collapse)AuthorAgeFilesLines
* pattern: Merge identical branchesNick Wellnhofer2023-02-211-16/+6
| | | | Fixes #479.
* Remove explicit integer castsNick Wellnhofer2022-09-011-2/+2
| | | | | | | | | | | | | | | | | | | | Remove explicit integer casts as final operation - in assignments - when passing arguments - when returning values Remove casts - to the same type - from certain range-bound values The main motivation is that these explicit casts don't change the result of operations and only render UBSan's implicit-conversion checks useless. Removing these casts allows UBSan to detect cases where truncation or sign-changes occur unexpectedly. Document some explicit casts as truncating and add a few missing ones.
* Remove DOCBparserNick Wellnhofer2022-03-041-12/+0
| | | | | | | This code has been broken and deprecated since version 2.6.0, released in 2003. Because of a bug in commit 961b535c, DOCBparser.c was never compiled since 2012. I couldn't find a Debian package using any of its symbols, so it seems safe to remove this module.
* Remove elfgcchack.hNick Wellnhofer2022-02-201-2/+0
| | | | | The same optimization can be enabled with -fno-semantic-interposition since GCC 5. clang has always used this option by default.
* Large batch of typo fixesJared Yanovich2019-09-301-4/+4
| | | | Closes #109.
* Fix call stack overflow in xmlFreePatternNick Wellnhofer2019-04-251-3/+6
| | | | | | | | Since xmlFreePattern tried to free the next pattern recursively, its behavior is identical to xmlFreePatternList. Make it call xmlFreePatternList to avoid call stack overflows. Found by OSS-Fuzz.
* Fix memory leak in pattern error pathNick Wellnhofer2017-05-271-0/+1
| | | | Found with libFuzzer and ASan.
* Big space and tab cleanupDaniel Veillard2012-09-111-89/+89
| | | | Remove all space before tabs and space and tabs at end of lines.
* undef ERROR if already definedPatrick R. Gansterer2012-05-101-0/+3
|
* Fix -Wempty-body warning from clangNico Weber2012-03-051-1/+2
| | | | | | clang recently grew a warning on `for (...);`. This patch fixes all two instances of this pattern in libxml. The changes don't modify the code semantic.
* fix problem with xmlStreamPop when pattern includes a "." element (seeWilliam M. Brack2008-07-171-3/+7
| | | | | | * pattern.c: fix problem with xmlStreamPop when pattern includes a "." element (see discussion on libxslt list) svn path=/trunk/; revision=3752
* fix crash from double free of name for bug #501760Rob Richards2007-12-061-0/+2
| | | | | | * pattern.c: fix crash from double free of name for bug #501760 svn path=/trunk/; revision=3667
* Applied patch from Rob Richards, fixing a potential memory leak inKasimier T. Buchcik2006-05-161-86/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* a bunch of small cleanups based on coverity reports. DanielDaniel Veillard2006-03-091-6/+0
| | | | | | * HTMLparser.c parser.c parserInternals.c pattern.c uri.c: a bunch of small cleanups based on coverity reports. Daniel
* upated the news regenerated the docs, preparing for release of 2.6.23LIBXML2_2_6_23Daniel Veillard2006-01-051-2/+2
| | | | | | | * NEWS configure.in libxml.spec.in testapi.c doc/*: upated the news regenerated the docs, preparing for release of 2.6.23 * pattern.c xmlschemas.c: fixed some comments Daniel
* Another fix to handle "foo//.": "foo" was not included in the resultingKasimier T. Buchcik2006-01-051-42/+47
| | | | | * pattern.c: Another fix to handle "foo//.": "foo" was not included in the resulting node-set.
* Fixed bug #322928, reported by Erich Schubert: The bug was in pattern.c,Kasimier T. Buchcik2006-01-051-55/+239
| | | | | | | | | | | | | * 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.
* Fixed a potential memory leak in xmlSchemaCheckCSelectorXPath() when anKasimier T. Buchcik2005-10-191-14/+170
| | | | | | | | | | | | | * xmlschemas.c: Fixed a potential memory leak in xmlSchemaCheckCSelectorXPath() when an internal error occurs. Fixed setting of ctxt->err to the given error code in the parsing error functions. * pattern.c: Added internal xmlCompileIDCXPathPath() as a starting point for IDC XPath compilation; this and some other tiny changes fixes issues regarding whitespace in the expressions and IDC selector/field relevant restrictions of the subset of XPath. Fixed a missing blocking of attributes in xmlStreamPushInternal().
* Silenced intel compiler warnings (reported by Kjartan Maraas, bugKasimier T. Buchcik2005-10-171-4/+2
| | | | | | | | | | | * tree.c pattern.c: Silenced intel compiler warnings (reported by Kjartan Maraas, bug #318517). * xmlschemas.c: The above changes in pattern.c revealed an inconsistency wrt IDCs: we now _only_ pop XPath states, if we really pushed them beforehand; this was previously not checked for the case when we discover an element node to be invalid wrt the content model. Fixed segfault in xmlSchemaGetEffectiveValueConstraint().
* Fixed some identity-constraint issues: Restructured IDC node-tablesKasimier T. Buchcik2005-10-141-6/+16
| | | | | | | | | | | | | | | | | | | | | | | | | * xmlschemas.c: Fixed some identity-constraint issues: Restructured IDC node-tables Allowed IDCs to resolve also to nodes of complex type with simple content. Added check for keyrefs with references to keyrefs. IDC target-nodes were interferring with IDC node-tables, since they used one list of entries only. I separated this one big list into 3 lists: 1 for IDC node-table entries, 1 for _duplicates_ of IDC node-table entries and 1 for IDC target-nodes. More code, but cleaner and it works at last. Keyrefs will fail to resolve to duplicate key/unique entries. I thought this was already working this way, but it didn't. The wording of the definition for [node table] in the spec can lead to a scenario, where keyrefs resolve perfectly, even if the relevant key-sequences of the referenced key/unique have duplicates in the subtree. Currently only Saxon 8.5.1 is dissallowing resolution to duplicate entries correctly - we will follow Saxon here. Removed some intel compiler warnings (reported by Kjartan Maraas, bug #318517). * pattern.c: Fixed an IDC-XPath problem when resolving to attributes.
* fixing yet another pattern induced XPath bug #314282 reverted back lastDaniel Veillard2005-09-041-0/+34
| | | | | | | * 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
* fixes a portability problem raised by C370 on Z/OS DanielDaniel Veillard2005-09-031-1/+1
| | | | | * pattern.c: fixes a portability problem raised by C370 on Z/OS Daniel
* changed xmlPatterncompile signature to pass an int and not an enum sinceDaniel Veillard2005-07-231-3/+2
| | | | | | | | | | | | | | | * 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 xmlCompileStepPattern() and xmlCompileAttributeTest() to handleKasimier T. Buchcik2005-07-221-34/+54
| | | | | | * pattern.c: Changed xmlCompileStepPattern() and xmlCompileAttributeTest() to handle the "xml" prefix without caring if the XML namespace was supplied by the user.
* Fixed evaluation of attributes. Actually only attribute at the first levelKasimier T. Buchcik2005-07-081-1/+1
| | | | | | * pattern.c: Fixed evaluation of attributes. Actually only attribute at the first level were evaluated (e.g. "@attr"); expression like "foo/@attr" always failed.
* adjusted last change to xmlCompilePathPattern, fixed one compilationWilliam M. Brack2005-06-141-2/+2
| | | | | * pattern.c: adjusted last change to xmlCompilePathPattern, fixed one compilation warning
* Some changes/fixes to the streaming evaluation. A bit of support forKasimier T. Buchcik2005-06-141-102/+189
| | | | | | | | | * pattern.c: Some changes/fixes to the streaming evaluation. * xmlschemas.c: A bit of support for parsing the schema for schema. Fixed attribute derivation when the use is "prohibited" and was "optional". Fixed an attribute construction bug, a left-over from the time, where <complexContent>, <extension>, etc. where created as structs.
* Further enhancement for XPath streaming, consolidated with schemas usageWilliam M. Brack2005-06-091-64/+49
| | | | | | | | | | | | * 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-25/+33
| | | | | | | | | * 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.
* Changed the XPath "." to resolve only on the first level for XML SchemaKasimier T. Buchcik2005-05-091-2/+11
| | | | | | * pattern.c: Changed the XPath "." to resolve only on the first level for XML Schema IDCs. This should not affect pattern-like resolution on every level.
* revamped the elfgcchack.h format to cope with gcc4 change of aliasingDaniel Veillard2005-04-011-0/+2
| | | | | | | | | | | * doc/apibuild.py doc/elfgcchack.xsl: revamped the elfgcchack.h format to cope with gcc4 change of aliasing allowed scopes, had to add extra informations to doc/libxml2-api.xml to separate the header from the c module source. * *.c: updated all c library files to add a #define bottom_xxx and reimport elfgcchack.h thereafter, and a bit of cleanups. * doc//* testapi.c: regenerated when rebuilding the API Daniel
* another patch from Brent Hendricks to add new handlers with the variousDaniel Veillard2005-03-301-1/+1
| | | | | | | | | * python/generator.py python/libxml.py: another patch from Brent Hendricks to add new handlers with the various validity contexts * python/tests/Makefile.am python/tests/validDTD.py python/tests/validRNG.py python/tests/validSchemas.py: also added the regression tests he provided Daniel
* Enabled IDC parsing and validation. Added xmlSchemaCopyValue to the API;Kasimier T. Buchcik2005-03-041-27/+44
| | | | | | | | | | * xmlschemas.c: Enabled IDC parsing and validation. * xmlschemastypes.c include/libxml/xmlschemastypes.h: Added xmlSchemaCopyValue to the API; this was done due to validation of default attributes against IDCs: since IDC keys consume the precomputed value, one needs a copy. * pattern.c: Enabled IDC support; this is currently done via calling xmlPatterncompile with a flag arg of 1.
* fixed remaining known bugs in the XPath streaming, and switched XPath toDaniel Veillard2005-02-211-3/+58
| | | | | | * pattern.c xpath.c: fixed remaining known bugs in the XPath streaming, and switched XPath to use it by default when possible Daniel
* Some experimental addition for parsing of expressions and streamableKasimier T. Buchcik2005-02-171-67/+284
| | | | | | * pattern.c pattern.h: Some experimental addition for parsing of expressions and streamable validation. Added xmlStreamPushAttr to the API.
* fix the comment to describe the real return values lot of work on theDaniel Veillard2005-02-161-11/+122
| | | | | | | | | | * encoding.c: fix the comment to describe the real return values * pattern.c xpath.c include/libxml/pattern.h: lot of work on the patterns, pluggin in the XPath default evaluation, but disabled right now because it's not yet good enough for XSLT. pattern.h streaming API are likely to be changed to handle relative and absolute paths in the same expression. Daniel
* fixed implementation for | added a specific regression test DanielDaniel Veillard2005-02-051-8/+15
| | | | | | | * pattern.c xmllint.c: fixed implementation for | * test/pattern/conj.* result/pattern/conj: added a specific regression test Daniel
* first implementation for | support DanielDaniel Veillard2005-02-051-130/+199
| | | | | * pattern.c: first implementation for | support Daniel
* fixed the namespaces support fixed xmlGetNodePath when namespaces are usedDaniel Veillard2005-02-051-6/+1
| | | | | | | | | * pattern.c: fixed the namespaces support * tree.c: fixed xmlGetNodePath when namespaces are used * result/pattern/multiple result/pattern/namespaces test/pattern/multiple.* test/pattern/namespaces.*: added more regression tests Daniel
* use the walker to test the patterns instead of the normal reader bug fixesDaniel Veillard2005-02-031-39/+118
| | | | | | | | * Makefile.am: use the walker to test the patterns instead of the normal reader * pattern.c xmllint.c: bug fixes in the train including fixing the stupid build break. Daniel
* Fixed debug in pattern.c, DanielDaniel Veillard2005-02-031-1/+1
|
* more bug fixes for the XPath streaming code. DanielDaniel Veillard2005-02-011-3/+15
| | | | | * pattern.c: more bug fixes for the XPath streaming code. Daniel
* bugfixes around the streaming patterns DanielDaniel Veillard2005-01-311-5/+14
| | | | | * pattern.c xmllint.c: bugfixes around the streaming patterns Daniel
* added first test for the patterns a few fixes DanielDaniel Veillard2005-01-301-1/+14
| | | | | | | * Makefile.am configure.in result/pattern/simple test/pattern/simple.*: added first test for the patterns * pattern.c xmllint.c: a few fixes Daniel
* Oops desabling debug, DanielDaniel Veillard2005-01-301-1/+1
|
* added a streaming pattern detector for a subset of XPath, should helpDaniel Veillard2005-01-301-8/+535
| | | | | | | | | * pattern.c include/libxml/pattern.h xmllint.c: added a streaming pattern detector for a subset of XPath, should help Kasimier for identity constraints * python/generator.py: applied Stephane Bidoul patch to find paths without breaking. Daniel
* fixed the fixed size array structure problem reported by Patrick StreuleDaniel Veillard2005-01-121-14/+48
| | | | | | * pattern.c: fixed the fixed size array structure problem reported by Patrick Streule Daniel
* removed some compilation warnings DanielDaniel Veillard2003-12-101-2/+3
| | | | | * SAX2.c pattern.c: removed some compilation warnings Daniel
* fixed the pattern interfaces but not yet the parser to handle theDaniel Veillard2003-12-051-5/+19
| | | | | | | | * pattern.c xmlreader.c xmllint.c include/libxml/pattern.h include/libxml/xmlreader.h: fixed the pattern interfaces but not yet the parser to handle the namespaces. * doc/examples/reader3.c doc/*: fixed the example, rebuilt the docs. Daniel
* cleanup the make rebuild in doc, this include new directive to stopDaniel Veillard2003-12-051-2/+2
| | | | | | | | | | | | | | | | | * globals.c xmlwriter.c doc/apibuild.py include/libxml/globals.h include/libxml/pattern.h include/libxml/schemasInternals.h include/libxml/xmlexports.h include/libxml/xmlwriter.h: cleanup the make rebuild in doc, this include new directive to stop documentation warnings * doc/* doc/html/*: rebuilt the docs * pattern.c xmlreader.c include/libxml/pattern.h include/libxml/xmlreader.h: adding xmlTextReaderPreservePattern() to save nodes while scanning the tree with the reader, cleanup the way element were freed, and xmlTextReaderPreserve() implementation, the API might change for namespace binding support when compiling patterns. * doc/examples/*: added reader3.c exposing the xmlTextReaderPreserve() Daniel