From 3c74bd4db78e934bd9c483443a9a31d3beae5ab6 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Tue, 21 Feb 2006 17:02:03 +0000 Subject: [PATCH] applied patch from Christopher R. Palmer to avoid a race condition in * libxslt/extensions.c libxslt/xslt.c libxslt/xslt.h libxslt/xsltInternals.h: applied patch from Christopher R. Palmer to avoid a race condition in xsltInit() Daniel --- ChangeLog | 6 ++++++ libxslt/extensions.c | 2 ++ libxslt/xslt.c | 21 +++++++++++++++++++-- libxslt/xslt.h | 7 +++++++ libxslt/xsltInternals.h | 8 ++++++++ 5 files changed, 42 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ae0bd26..0f1c016 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Feb 21 17:59:11 CET 2006 Daniel Veillard + + * libxslt/extensions.c libxslt/xslt.c libxslt/xslt.h + libxslt/xsltInternals.h: applied patch from Christopher R. Palmer + to avoid a race condition in xsltInit() + Sun Feb 19 22:40:58 CET 2006 Daniel Veillard * doc/xsltproc.1 doc/xsltproc.xml: improvement of the man page diff --git a/libxslt/extensions.c b/libxslt/extensions.c index 324dff3..450474a 100644 --- a/libxslt/extensions.c +++ b/libxslt/extensions.c @@ -1881,6 +1881,8 @@ xsltCleanupGlobals(void) xmlHashFree(xsltModuleHash, NULL); xsltModuleHash = NULL; } + + xsltUninit(); } static void diff --git a/libxslt/xslt.c b/libxslt/xslt.c index 6f59d4c..07e4081 100644 --- a/libxslt/xslt.c +++ b/libxslt/xslt.c @@ -148,9 +148,26 @@ exclPrefixPop(xsltStylesheetPtr style) * Initializes the processor (e.g. registers built-in extensions, * etc.) */ -static void + +static int initialized = 0; + +void xsltInit (void) { - xsltRegisterAllExtras(); + if (initialized == 0) { + initialized = 1; + xsltRegisterAllExtras(); + } +} + +/** + * xsltUninit + * + * Uninitializes the processor. + */ + +void +xsltUninit (void) { + initialized = 0; } /** diff --git a/libxslt/xslt.h b/libxslt/xslt.h index 0404581..849b03c 100644 --- a/libxslt/xslt.h +++ b/libxslt/xslt.h @@ -83,6 +83,13 @@ XSLTPUBVAR const int xsltLibxsltVersion; XSLTPUBVAR const int xsltLibxmlVersion; /* + * Global initialization function. + */ + +XSLTPUBFUN void XSLTCALL + xsltInit (void); + +/* * Global cleanup function. */ XSLTPUBFUN void XSLTCALL diff --git a/libxslt/xsltInternals.h b/libxslt/xsltInternals.h index 193316f..2c6b54e 100644 --- a/libxslt/xsltInternals.h +++ b/libxslt/xsltInternals.h @@ -694,6 +694,14 @@ XSLTPUBFUN xmlChar * XSLTCALL xmlNodePtr node); XSLTPUBFUN void XSLTCALL xsltFreeAVTList (void *avt); + +/* + * Extra function for successful xsltCleanupGlobals / xsltInit sequence. + */ + +XSLTPUBFUN void XSLTCALL + xsltUninit (void); + #ifdef __cplusplus } #endif -- 2.7.4