1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-26 00:37:43 +03:00

Store per-element parser state in a struct

Make the parser context's "pushTab" point to an array of structs
instead of void pointers. This avoids casting unrelated types to void
pointers, improving readability and portability, and allows for more
efficient packing. Ultimately, the struct could be extended to include
the contents of "nameTab" and "spaceTab", further simplifying the code.

Historically, "pushTab" was only used by the push parser (hence the
name), so the change to the public headers should be safe.

Also remove an unused parameter from xmlParseEndTag2.
This commit is contained in:
Nick Wellnhofer
2021-05-08 21:20:05 +02:00
parent de5b624f10
commit ce00c36e65
2 changed files with 35 additions and 52 deletions

View File

@@ -169,6 +169,8 @@ typedef enum {
XML_PARSE_READER = 5
} xmlParserMode;
typedef struct _xmlStartTag xmlStartTag;
/**
* xmlParserCtxt:
*
@@ -280,7 +282,7 @@ struct _xmlParserCtxt {
int nsMax; /* the size of the arrays */
const xmlChar * *nsTab; /* the array of prefix/namespace name */
int *attallocs; /* which attribute were allocated */
void * *pushTab; /* array of data for push */
xmlStartTag *pushTab; /* array of data for push */
xmlHashTablePtr attsDefault; /* defaulted attributes if any */
xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */
int nsWellFormed; /* is the document XML Namespace okay */