1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-24 13:33:01 +03:00

parser: Use hash tables to avoid quadratic behavior

Use a hash table to lookup namespaces by prefix. The hash table stores
an index into the namespace table. Auxiliary data for namespaces is
stored in a separate array along the main namespace table.

Use a hash table to verify attribute uniqueness. The hash table stores
an index into the attribute table.

Reuse hash value from the dictionary to avoid computing them twice.

See #346.
This commit is contained in:
Nick Wellnhofer
2023-09-29 00:18:44 +02:00
parent e48f3d8e0a
commit e0dd330b8f
5 changed files with 1051 additions and 374 deletions

View File

@@ -49,4 +49,16 @@ xmlDetectEncoding(xmlParserCtxtPtr ctxt);
XML_HIDDEN void
xmlSetDeclaredEncoding(xmlParserCtxtPtr ctxt, xmlChar *encoding);
/*
* These functions allow SAX handlers to attach extra data to namespaces
* efficiently and should be made public.
*/
void
xmlParserNsFree(xmlParserNsData *nsdb);
XML_HIDDEN int
xmlParserNsUpdateSax(xmlParserCtxtPtr ctxt, const xmlChar *prefix,
void *saxData);
XML_HIDDEN void *
xmlParserNsLookupSax(xmlParserCtxtPtr ctxt, const xmlChar *prefix);
#endif /* XML_PARSER_H_PRIVATE__ */