mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
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
This commit is contained in:
12
tree.c
12
tree.c
@ -156,7 +156,7 @@ xmlBuildQName(const xmlChar *ncname, const xmlChar *prefix,
|
||||
lenp = strlen((char *) prefix);
|
||||
|
||||
if ((memory == NULL) || (len < lenn + lenp + 2)) {
|
||||
ret = (xmlChar *) xmlMalloc(lenn + lenp + 2);
|
||||
ret = (xmlChar *) xmlMallocAtomic(lenn + lenp + 2);
|
||||
if (ret == NULL) return(NULL);
|
||||
} else {
|
||||
ret = memory;
|
||||
@ -3977,10 +3977,10 @@ xmlGetNodePath(xmlNodePtr node)
|
||||
return (NULL);
|
||||
|
||||
buf_len = 500;
|
||||
buffer = (xmlChar *) xmlMalloc(buf_len * sizeof(xmlChar));
|
||||
buffer = (xmlChar *) xmlMallocAtomic(buf_len * sizeof(xmlChar));
|
||||
if (buffer == NULL)
|
||||
return (NULL);
|
||||
buf = (xmlChar *) xmlMalloc(buf_len * sizeof(xmlChar));
|
||||
buf = (xmlChar *) xmlMallocAtomic(buf_len * sizeof(xmlChar));
|
||||
if (buf == NULL) {
|
||||
xmlFree(buffer);
|
||||
return (NULL);
|
||||
@ -6087,7 +6087,7 @@ xmlBufferCreate(void) {
|
||||
ret->use = 0;
|
||||
ret->size = xmlDefaultBufferSize;
|
||||
ret->alloc = xmlBufferAllocScheme;
|
||||
ret->content = (xmlChar *) xmlMalloc(ret->size * sizeof(xmlChar));
|
||||
ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar));
|
||||
if (ret->content == NULL) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlBufferCreate : out of memory!\n");
|
||||
@ -6119,7 +6119,7 @@ xmlBufferCreateSize(size_t size) {
|
||||
ret->alloc = xmlBufferAllocScheme;
|
||||
ret->size = (size ? size+2 : 0); /* +1 for ending null */
|
||||
if (ret->size){
|
||||
ret->content = (xmlChar *) xmlMalloc(ret->size * sizeof(xmlChar));
|
||||
ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar));
|
||||
if (ret->content == NULL) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlBufferCreate : out of memory!\n");
|
||||
@ -6338,7 +6338,7 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size)
|
||||
}
|
||||
|
||||
if (buf->content == NULL)
|
||||
rebuf = (xmlChar *) xmlMalloc(newSize * sizeof(xmlChar));
|
||||
rebuf = (xmlChar *) xmlMallocAtomic(newSize * sizeof(xmlChar));
|
||||
else
|
||||
rebuf = (xmlChar *) xmlRealloc(buf->content,
|
||||
newSize * sizeof(xmlChar));
|
||||
|
Reference in New Issue
Block a user