added xmlMallocAtomic() to be used when allocating blocks which do not
* DOCBparser.c HTMLparser.c c14n.c catalog.c encoding.c globals.c
nanohttp.c parser.c parserInternals.c relaxng.c tree.c uri.c
xmlmemory.c xmlreader.c xmlregexp.c xpath.c xpointer.c
include/libxml/globals.h include/libxml/xmlmemory.h: added
xmlMallocAtomic() to be used when allocating blocks which
do not contains pointers, add xmlGcMemSetup() and xmlGcMemGet()
to allow registering the full set of functions needed by
a garbage collecting allocator like libgc, ref #109944
Daniel
diff --git a/uri.c b/uri.c
index ab03767..b5d9360 100644
--- a/uri.c
+++ b/uri.c
@@ -227,7 +227,7 @@
max = 80;
- ret = (xmlChar *) xmlMalloc((max + 1) * sizeof(xmlChar));
+ ret = (xmlChar *) xmlMallocAtomic((max + 1) * sizeof(xmlChar));
if (ret == NULL) {
xmlGenericError(xmlGenericErrorContext,
"xmlSaveUri: out of memory\n");
@@ -803,7 +803,7 @@
if (len < 0) return(NULL);
if (target == NULL) {
- ret = (char *) xmlMalloc(len + 1);
+ ret = (char *) xmlMallocAtomic(len + 1);
if (ret == NULL) {
xmlGenericError(xmlGenericErrorContext,
"xmlURIUnescapeString: out of memory\n");
@@ -864,7 +864,7 @@
if (!(len > 0)) return(NULL);
len += 20;
- ret = (xmlChar *) xmlMalloc(len);
+ ret = (xmlChar *) xmlMallocAtomic(len);
if (ret == NULL) {
xmlGenericError(xmlGenericErrorContext,
"xmlURIEscapeStr: out of memory\n");
@@ -1391,7 +1391,7 @@
len2 = strlen(uri->path);
len += len2;
}
- path = (char *) xmlMalloc(len + 1);
+ path = (char *) xmlMallocAtomic(len + 1);
if (path == NULL) {
xmlGenericError(xmlGenericErrorContext,
"xmlParseURIPathSegments: out of memory\n");
@@ -1885,7 +1885,7 @@
len += strlen(ref->path);
if (bas->path != NULL)
len += strlen(bas->path);
- res->path = (char *) xmlMalloc(len);
+ res->path = (char *) xmlMallocAtomic(len);
if (res->path == NULL) {
xmlGenericError(xmlGenericErrorContext,
"xmlBuildURI: out of memory\n");
@@ -1997,7 +1997,7 @@
len = xmlStrlen(path);
if ((len > 2) && IS_WINDOWS_PATH(path)) {
uri->scheme = xmlStrdup(BAD_CAST "file");
- uri->path = xmlMalloc(len + 2);
+ uri->path = xmlMallocAtomic(len + 2);
uri->path[0] = '/';
p = uri->path + 1;
strncpy(p, path, len + 1);