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

valid: Improve addition and deletion of IDs

Introduce a new API function xmlAddIDSafe that returns a separate error
code if a memory allocation fails.

Store a pointer to the ID struct in xmlAttr so attributes can be
freed without allocating memory. It's impossible to report malloc
failures in deallocation code.
This commit is contained in:
Nick Wellnhofer
2023-12-10 16:29:31 +01:00
parent e1560990ec
commit e34a49b78e
3 changed files with 117 additions and 78 deletions

View File

@@ -249,6 +249,12 @@ XMLPUBFUN void
#endif /* LIBXML_OUTPUT_ENABLED */
/* IDs */
XMLPUBFUN int
xmlAddIDSafe (xmlDocPtr doc,
const xmlChar *value,
xmlAttrPtr attr,
int streaming,
xmlIDPtr *id);
XMLPUBFUN xmlIDPtr
xmlAddID (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,