diff --git a/packages/libxml/src/globals.inc b/packages/libxml/src/globals.inc index c10c08d0cb..64f2aa01d4 100644 --- a/packages/libxml/src/globals.inc +++ b/packages/libxml/src/globals.inc @@ -155,12 +155,39 @@ var {$ENDIF} {$ELSE} (* !LIBXML_THREAD_ALLOC_ENABLED *) +{$IFDEF NO_EXTERNAL_VARS} var - xmlMalloc: xmlMallocFunc; {$IFNDEF NO_EXTERNAL_VARS}cvar; external;{$ENDIF} - xmlMallocAtomic: xmlMallocFunc; {$IFNDEF NO_EXTERNAL_VARS}cvar; external;{$ENDIF} - xmlRealloc: xmlReallocFunc; {$IFNDEF NO_EXTERNAL_VARS}cvar; external;{$ENDIF} - xmlFree: xmlFreeFunc; {$IFNDEF NO_EXTERNAL_VARS}cvar; external;{$ENDIF} - xmlMemStrdup: xmlStrdupFunc; {$IFNDEF NO_EXTERNAL_VARS}cvar; external;{$ENDIF} + varxmlMalloc: PxmlMallocFunc; + varxmlMallocAtomic: PxmlMallocFunc; + varxmlRealloc: PxmlReallocFunc; + varxmlFree: PxmlFreeFunc; + varxmlMemStrdup: PxmlStrdupFunc; + +function GetxmlMalloc: xmlMallocFunc; inline; +procedure SetxmlMalloc(AValue: xmlMallocFunc); inline; +function GetxmlMallocAtomic: xmlMallocFunc; inline; +procedure SetxmlMallocAtomic(AValue: xmlMallocFunc); inline; +function GetxmlRealloc: xmlReallocFunc; inline; +procedure SetxmlRealloc(AValue: xmlReallocFunc); inline; +function GetxmlFree: xmlFreeFunc; inline; +procedure SetxmlFree(AValue: xmlFreeFunc); inline; +function GetxmlMemStrdup: xmlStrdupFunc; inline; +procedure SetxmlMemStrdup(AValue: xmlStrdupFunc); inline; + +property xmlMalloc: xmlMallocFunc read GetxmlMalloc write SetxmlMalloc; +property xmlMallocAtomic: xmlMallocFunc read GetxmlMallocAtomic write SetxmlMallocAtomic; +property xmlRealloc: xmlReallocFunc read GetxmlRealloc write SetxmlRealloc; +property xmlFree: xmlFreeFunc read GetxmlFree write SetxmlFree; +property xmlMemStrdup: xmlStrdupFunc read GetxmlMemStrdup write SetxmlMemStrdup; + +{$ELSE} +var + xmlMalloc: xmlMallocFunc; cvar; external; + xmlMallocAtomic: xmlMallocFunc; cvar; external; + xmlRealloc: xmlReallocFunc; cvar; external; + xmlFree: xmlFreeFunc; cvar; external; + xmlMemStrdup: xmlStrdupFunc; cvar; external; +{$ENDIF} {$ENDIF} (* LIBXML_THREAD_ALLOC_ENABLED *) {$IFDEF LIBXML_DOCB_ENABLED} diff --git a/packages/libxml/src/xmlmemory.inc b/packages/libxml/src/xmlmemory.inc index 7b42c6082c..dbc07f20bb 100644 --- a/packages/libxml/src/xmlmemory.inc +++ b/packages/libxml/src/xmlmemory.inc @@ -45,6 +45,9 @@ * Signature for a free() implementation. *) xmlFreeFunc = procedure(mem: pointer); EXTDECL; + {$IFDEF NO_EXTERNAL_VARS} + PxmlFreeFunc = ^xmlFreeFunc; + {$ENDIF} (** * xmlMallocFunc: @@ -55,6 +58,9 @@ * Returns a pointer to the newly allocated block or NULL in case of error. *) xmlMallocFunc = function(size: csize_t): pointer; EXTDECL; + {$IFDEF NO_EXTERNAL_VARS} + PxmlMallocFunc = ^xmlMallocFunc; + {$ENDIF} (** * xmlReallocFunc: @@ -66,6 +72,9 @@ * Returns a pointer to the newly reallocated block or NULL in case of error. *) xmlReallocFunc = function(mem: pointer; size: csize_t): pointer; EXTDECL; + {$IFDEF NO_EXTERNAL_VARS} + PxmlReallocFunc = ^xmlReallocFunc; + {$ENDIF} (** * xmlStrdupFunc: @@ -76,6 +85,9 @@ * Returns the copy of the string or NULL in case of error. *) xmlStrdupFunc = function(str: pchar): pchar; EXTDECL; + {$IFDEF NO_EXTERNAL_VARS} + PxmlStrdupFunc = ^xmlStrdupFunc; + {$ENDIF} (* * The 4 interfaces used for all memory handling within libxml. @@ -170,4 +182,4 @@ function xmlMemStrdupLoc(str: pchar; _file: pchar; line: cint): pchar; EXTDECL; //#define xmlMemStrdup(str) xmlMemStrdupLoc((str), __FILE__, __LINE__) {$ENDIF} (* DEBUG_MEMORY_LOCATION *) -{$ENDIF} \ No newline at end of file +{$ENDIF}