X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Finit_globals.c;h=786cb9c3425b74874ac46d8be11b2d3ad9228716;hb=917d2c4a288a19c0da7fa98ad514288d0e045413;hp=abb918b093093f565bf1e28822d5fb90ba6a3491;hpb=935b1ba0c2c3dc480b0afcb3673abe2ef2dd893f;p=yaz-moved-to-github.git diff --git a/src/init_globals.c b/src/init_globals.c index abb918b..786cb9c 100644 --- a/src/init_globals.c +++ b/src/init_globals.c @@ -12,6 +12,8 @@ #include #endif +#include + #if YAZ_POSIX_THREADS #include #endif @@ -25,6 +27,14 @@ #include #endif +#if YAZ_HAVE_XML2 +#include +#endif + +#if YAZ_HAVE_XSLT +#include +#endif + #if YAZ_HAVE_EXSLT #include #endif @@ -51,7 +61,7 @@ void yaz_init_globals(void) { yaz_log_init_globals(); #if HAVE_GCRYPT_H - /* POSIX threads locking. gnutls_global_init will not override */ + /* POSIX threads locking. In case gnutls_global_init do not override */ gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); #endif #if HAVE_GNUTLS_H @@ -64,6 +74,12 @@ void yaz_init_globals(void) gcry_control(GCRYCTL_INITIALIZATION_FINISHED, NULL, 0); } #endif +#if YAZ_HAVE_XML2 + xmlInitParser(); +#endif +#if YAZ_HAVE_XSLT + xsltInit(); +#endif #if YAZ_HAVE_EXSLT exsltRegisterAll(); #endif @@ -74,6 +90,31 @@ void yaz_init_globals(void) #endif } +void yaz_deinit_globals(void) +{ + if (!yaz_init_flag) + return; +#if YAZ_POSIX_THREADS + pthread_mutex_lock(&yaz_init_mutex); +#endif + if (yaz_init_flag) + { +#if HAVE_GNUTLS_H + gnutls_global_deinit(); +#endif +#if YAZ_HAVE_XSLT + xsltCleanupGlobals(); +#endif +#if YAZ_HAVE_XML2 + xmlCleanupParser(); +#endif + yaz_init_flag = 0; + } +#if YAZ_POSIX_THREADS + pthread_mutex_unlock(&yaz_init_mutex); +#endif +} + /* * Local variables: * c-basic-offset: 4