diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-03-31 23:18:25 +0200 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2020-05-04 13:53:11 +0200 |
commit | 9fa3200cb366c726f7c8ef234282603bb9e8816d (patch) | |
tree | 6d1fda0dcbe3d4394c09397ff7cd4c4fc1a0248e | |
parent | e4fb36841800038c289997432ca547c9bfef9db1 (diff) | |
download | libxml2-9fa3200cb366c726f7c8ef234282603bb9e8816d.tar.gz |
Call xmlCleanupParser on ELF destruction
Fixes #153.
-rw-r--r-- | configure.ac | 10 | ||||
-rw-r--r-- | parser.c | 11 |
2 files changed, 20 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 09418af2..5f95fee0 100644 --- a/configure.ac +++ b/configure.ac @@ -641,6 +641,16 @@ else [Type cast for the send() function 2nd arg]) fi +dnl Checking whether __attribute__((destructor)) is accepted by the compiler +AC_MSG_CHECKING([whether __attribute__((destructor)) is accepted]) +AC_TRY_COMPILE2([ +void __attribute__((destructor)) +f(void) {}], [], [ + AC_MSG_RESULT(yes) + AC_DEFINE([ATTRIBUTE_DESTRUCTOR], [1],[Define if __attribute__((destructor)) is accepted])],[ + AC_MSG_RESULT(no)]) + + dnl ***********************Checking for availability of IPv6******************* AC_MSG_CHECKING([whether to enable IPv6]) @@ -14599,7 +14599,7 @@ xmlInitParser(void) { if (xmlParserInitialized != 0) return; -#if defined(WIN32) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)) +#if defined(_WIN32) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)) atexit(xmlCleanupParser); #endif @@ -14681,6 +14681,15 @@ xmlCleanupParser(void) { xmlParserInitialized = 0; } +#if defined(ATTRIBUTE_DESTRUCTOR) && !defined(LIBXML_STATIC) && \ + !defined(_WIN32) +static void +__attribute__((destructor)) +xmlDestructor(void) { + xmlCleanupParser(); +} +#endif + /************************************************************************ * * * New set (2.6.0) of simpler and more flexible APIs * |