Commit 64a411cc authored by Daniel Veillard's avatar Daniel Veillard
Browse files

make the allocation be per-thread a configure option fixed compilation

* include/libxml/globals.h configure.in global.data: make
  the allocation be per-thread a configure option
* encoding.c include/libxml/parser.h: fixed compilation
  errors
Daniel
parent 5ee57fc9
Mon Oct 15 14:30:11 CEST 2001 Daniel Veillard <daniel@veillard.com>
* include/libxml/globals.h configure.in global.data: make
the allocation be per-thread a configure option
* encoding.c include/libxml/parser.h: fixed compilation
errors
Mon Oct 15 12:45:03 CEST 2001 Daniel Veillard <daniel@veillard.com>
* include/libxml/parser.h: Norm reported that a few lines
......
......@@ -249,6 +249,7 @@ dnl
THREAD_LIBS=""
WITH_THREADS=0
THREAD_CFLAGS=""
AC_ARG_WITH(threads, [ --with-threads Add multithread support(off)])
if test "$with_threads" = "yes" ; then
echo Enabling multithreaded support
......@@ -264,6 +265,11 @@ if test "$with_threads" = "yes" ; then
THREAD_CFLAGS="$XML_CFLAGS -D_REENTRANT"
fi
fi
AC_ARG_WITH(thread-alloc, [ --with-thread-alloc Add per-thread memory(off)])
if test "$with_threads" = "yes" -a "$WITH_THREADS" = "1" ; then
THREAD_CFLAGS="$XML_CFLAGS -DLIBXML_THREAD_ALLOC_ENABLED"
fi
AC_SUBST(THREAD_LIBS)
AC_SUBST(WITH_THREADS)
AC_SUBST(THREAD_CFLAGS)
......
......@@ -44,6 +44,7 @@
#include <libxml/HTMLparser.h>
#endif
#include <libxml/xmlerror.h>
#include <libxml/globals.h>
static xmlCharEncodingHandlerPtr xmlUTF16LEHandler = NULL;
static xmlCharEncodingHandlerPtr xmlUTF16BEHandler = NULL;
......
......@@ -6,7 +6,6 @@ int,xmlDefaultBufferSize
xmlSAXHandler,xmlDefaultSAXHandler
xmlSAXLocator,xmlDefaultSAXLocator
int,xmlDoValidityCheckingDefaultValue
xmlFreeFunc,xmlFree
xmlGenericErrorFunc,xmlGenericError
void *,xmlGenericErrorContext
int,xmlGetWarningsDefaultValue
......@@ -14,14 +13,11 @@ int,xmlIndentTreeOutput
int,xmlKeepBlanksDefaultValue
int,xmlLineNumbersDefaultValue
int,xmlLoadExtDtdDefaultValue
xmlMallocFunc,xmlMalloc
xmlStrdupFunc,xmlMemStrdup
int,xmlParserDebugEntities
const char *,xmlParserVersion
int,xmlPedanticParserDefaultValue
xmlReallocFunc,xmlRealloc
int,xmlSaveNoEmptyTags
#const xmlChar,xmlStringComment,[]
#const xmlChar,xmlStringText,[]
#const xmlChar,xmlStringTextNoenc,[]
int,xmlSubstituteEntitiesDefaultValue
\ No newline at end of file
int,xmlSubstituteEntitiesDefaultValue
......@@ -90,6 +90,54 @@ struct _xmlGlobalState
void xmlInitializeGlobalState(xmlGlobalStatePtr gs);
/*
* In general the memory allocation entry points are not kept
* thread specific but this can be overriden by LIBXML_THREAD_ALLOC_ENABLED
* - xmlMalloc
* - xmlRealloc
* - xmlMemStrdup
* - xmlFree
*/
#ifdef LIBXML_THREAD_ALLOC_ENABLED
#ifdef LIBXML_THREAD_ENABLED
extern xmlMallocFunc *__xmlMalloc(void);
#define xmlMalloc \
(*(__xmlMalloc()))
#else
LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMalloc;
#endif
#ifdef LIBXML_THREAD_ENABLED
extern xmlReallocFunc *__xmlRealloc(void);
#define xmlRealloc \
(*(__xmlRealloc()))
#else
LIBXML_DLL_IMPORT extern xmlReallocFunc xmlRealloc;
#endif
#ifdef LIBXML_THREAD_ENABLED
extern xmlFreeFunc *__xmlFree(void);
#define xmlFree \
(*(__xmlFree()))
#else
LIBXML_DLL_IMPORT extern xmlFreeFunc xmlFree;
#endif
#ifdef LIBXML_THREAD_ENABLED
extern xmlStrdupFunc *__xmlMemStrdup(void);
#define xmlMemStrdup \
(*(__xmlMemStrdup()))
#else
LIBXML_DLL_IMPORT extern xmlStrdupFunc xmlMemStrdup;
#endif
#else /* !LIBXML_THREAD_ALLOC_ENABLED */
LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMalloc;
LIBXML_DLL_IMPORT extern xmlReallocFunc xmlRealloc;
LIBXML_DLL_IMPORT extern xmlFreeFunc xmlFree;
LIBXML_DLL_IMPORT extern xmlStrdupFunc xmlMemStrdup;
#endif /* LIBXML_THREAD_ALLOC_ENABLED */
/*
* Everything starting from the line below is
* Automatically generated by build_glob.py.
......@@ -161,14 +209,6 @@ extern int *__xmlDoValidityCheckingDefaultValue(void);
LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue;
#endif
#ifdef LIBXML_THREAD_ENABLED
extern xmlFreeFunc *__xmlFree(void);
#define xmlFree \
(*(__xmlFree()))
#else
LIBXML_DLL_IMPORT extern xmlFreeFunc xmlFree;
#endif
#ifdef LIBXML_THREAD_ENABLED
extern xmlGenericErrorFunc *__xmlGenericError(void);
#define xmlGenericError \
......@@ -225,22 +265,6 @@ extern int *__xmlLoadExtDtdDefaultValue(void);
LIBXML_DLL_IMPORT extern int xmlLoadExtDtdDefaultValue;
#endif
#ifdef LIBXML_THREAD_ENABLED
extern xmlMallocFunc *__xmlMalloc(void);
#define xmlMalloc \
(*(__xmlMalloc()))
#else
LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMalloc;
#endif
#ifdef LIBXML_THREAD_ENABLED
extern xmlStrdupFunc *__xmlMemStrdup(void);
#define xmlMemStrdup \
(*(__xmlMemStrdup()))
#else
LIBXML_DLL_IMPORT extern xmlStrdupFunc xmlMemStrdup;
#endif
#ifdef LIBXML_THREAD_ENABLED
extern int *__xmlParserDebugEntities(void);
#define xmlParserDebugEntities \
......@@ -265,14 +289,6 @@ extern int *__xmlPedanticParserDefaultValue(void);
LIBXML_DLL_IMPORT extern int xmlPedanticParserDefaultValue;
#endif
#ifdef LIBXML_THREAD_ENABLED
extern xmlReallocFunc *__xmlRealloc(void);
#define xmlRealloc \
(*(__xmlRealloc()))
#else
LIBXML_DLL_IMPORT extern xmlReallocFunc xmlRealloc;
#endif
#ifdef LIBXML_THREAD_ENABLED
extern int *__xmlSaveNoEmptyTags(void);
#define xmlSaveNoEmptyTags \
......
......@@ -13,9 +13,6 @@
#include <libxml/valid.h>
#include <libxml/xmlIO.h>
#include <libxml/entities.h>
#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
#include <pthread.h>
#endif
#ifdef __cplusplus
extern "C" {
......@@ -579,5 +576,7 @@ xmlParserInputPtr
}
#endif
#include <libxml/globals.h>
#endif /* __XML_PARSER_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment