[libxml2] Define LIBXML_THREAD_ALLOC_ENABLED via xmlversion.h



commit 0ad948ede2b5060a144c72e4e27c38d24a272ef4
Author: Tim Starling <tstarling wikimedia org>
Date:   Mon Oct 29 13:41:55 2012 +1100

    Define LIBXML_THREAD_ALLOC_ENABLED via xmlversion.h
    
    Otherwise, direct calls to xmlFree() etc. from the application will
    use a different set of allocation functions to what was used to allocate
    the memory internally.

 configure.in                   |    4 +++-
 include/libxml/xmlversion.h.in |    9 +++++++++
 2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/configure.in b/configure.in
index 6da057c..245c033 100644
--- a/configure.in
+++ b/configure.in
@@ -954,6 +954,7 @@ WITH_THREADS=0
 THREAD_CFLAGS=""
 TEST_THREADS=""
 THREADS_W32=""
+WITH_THREAD_ALLOC=0
 
 if test "$with_threads" = "no" ; then
     echo Disabling multithreaded support
@@ -1017,7 +1018,7 @@ else
     fi
 fi
 if test "$with_thread_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
-    THREAD_CFLAGS="$THREAD_CFLAGS -DLIBXML_THREAD_ALLOC_ENABLED"
+    WITH_THREAD_ALLOC=1
 fi
 
 AC_SUBST(THREAD_LIBS)
@@ -1025,6 +1026,7 @@ AC_SUBST(BASE_THREAD_LIBS)
 AC_SUBST(WITH_THREADS)
 AC_SUBST(THREAD_CFLAGS)
 AC_SUBST(TEST_THREADS)
+AC_SUBST(WITH_THREAD_ALLOC)
 AM_CONDITIONAL([THREADS_W32],[test -n "$THREADS_W32"])
 
 dnl
diff --git a/include/libxml/xmlversion.h.in b/include/libxml/xmlversion.h.in
index c98e7ca..00a836f 100644
--- a/include/libxml/xmlversion.h.in
+++ b/include/libxml/xmlversion.h.in
@@ -98,6 +98,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
 #endif
 
 /**
+ * LIBXML_THREAD_ALLOC_ENABLED:
+ *
+ * Whether the allocation hooks are per-thread
+ */
+#if @WITH_THREAD_ALLOC@
+#define LIBXML_THREAD_ALLOC_ENABLED
+#endif
+
+/**
  * LIBXML_TREE_ENABLED:
  *
  * Whether the DOM like tree manipulation API support is configured in



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]