1
0
mirror of https://gitlab.gnome.org/GNOME/libxslt synced 2025-08-07 10:42:55 +03:00

more cleanup of the problems introduced with EXSLT, also closes bug #58180

* libexslt/functions.c libxslt/extensions.[ch] libxslt/extensions.h
  libxslt/xslt.[hc] libxslt/xsltInternals.h xsltproc/xsltproc.c:
  more cleanup of the problems introduced with EXSLT, also closes
  bug #58180
Daniel
This commit is contained in:
Daniel Veillard
2001-07-28 18:38:48 +00:00
parent 36c8640ac5
commit 06599b30b7
8 changed files with 45 additions and 19 deletions

View File

@@ -1,3 +1,10 @@
Sun Jul 29 08:37:59 EDT 2001 Daniel Veillard <daniel@veillard.com>
* libexslt/functions.c libxslt/extensions.[ch] libxslt/extensions.h
libxslt/xslt.[hc] libxslt/xsltInternals.h xsltproc/xsltproc.c:
more cleanup of the problems introduced with EXSLT, also closes
bug #58180
Sat Jul 28 08:25:05 MDT 2001 John Fleck <jfleck@inkstain.net> Sat Jul 28 08:25:05 MDT 2001 John Fleck <jfleck@inkstain.net>
* doc/internals.html - general cleanup * doc/internals.html - general cleanup

View File

@@ -1,14 +1,18 @@
#include "libxslt/libxslt.h"
#include <string.h> #include <string.h>
#include <libxml/tree.h> #include <libxml/tree.h>
#include <libxml/xpath.h> #include <libxml/xpath.h>
#include <libxml/xpathInternals.h> #include <libxml/xpathInternals.h>
#include <libxml/hash.h> #include <libxml/hash.h>
#include <libxml/debugXML.h>
#include <libxslt/xsltutils.h> #include <libxslt/xsltutils.h>
#include <libxslt/variables.h> #include <libxslt/variables.h>
#include <libxslt/xsltInternals.h> #include <libxslt/xsltInternals.h>
#include <libxslt/extensions.h> #include <libxslt/extensions.h>
#include <libxslt/transform.h>
#include "exslt.h" #include "exslt.h"
@@ -167,7 +171,6 @@ exsltFuncNewFunctionData (void) {
static void static void
exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) { exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xmlXPathObjectPtr obj, oldResult, ret; xmlXPathObjectPtr obj, oldResult, ret;
xmlHashTablePtr funcs;
exsltFuncData *data; exsltFuncData *data;
exsltFuncFunctionData *func; exsltFuncFunctionData *func;
xmlNodePtr paramNode, oldInsert, fake; xmlNodePtr paramNode, oldInsert, fake;
@@ -340,8 +343,9 @@ exsltFuncFunctionComp (xsltStylesheetPtr style, xmlNodePtr inst) {
} }
static void static void
exsltFuncResultElem (xsltTransformContextPtr ctxt, xmlNodePtr node, exsltFuncResultElem (xsltTransformContextPtr ctxt,
xmlNodePtr inst, xsltStylePreCompPtr comp) { xmlNodePtr node ATTRIBUTE_UNUSED, xmlNodePtr inst,
xsltStylePreCompPtr comp ATTRIBUTE_UNUSED) {
xmlNodePtr test; xmlNodePtr test;
xmlChar *select; xmlChar *select;
exsltFuncData *data; exsltFuncData *data;

View File

@@ -851,7 +851,7 @@ xsltUnregisterExtModule(const xmlChar * URI)
* *
* Unregister all the XSLT extension module from the library. * Unregister all the XSLT extension module from the library.
*/ */
void static void
xsltUnregisterAllExtModules(void) xsltUnregisterAllExtModules(void)
{ {
if (xsltExtensionsHash == NULL) if (xsltExtensionsHash == NULL)
@@ -948,7 +948,7 @@ xsltUnregisterExtModuleFunction (const xmlChar *name,
* *
* Unregisters all extension module function * Unregisters all extension module function
*/ */
void static void
xsltUnregisterAllExtModuleFunction (void) { xsltUnregisterAllExtModuleFunction (void) {
xmlHashFree(xsltFunctionsHash, NULL); xmlHashFree(xsltFunctionsHash, NULL);
xsltFunctionsHash = NULL; xsltFunctionsHash = NULL;
@@ -1088,7 +1088,7 @@ xsltUnregisterExtModuleElement (const xmlChar *name,
* *
* Unregisters all extension module element * Unregisters all extension module element
*/ */
void static void
xsltUnregisterAllExtModuleElement (void) { xsltUnregisterAllExtModuleElement (void) {
xmlHashFree(xsltElementsHash, (xmlHashDeallocator) xsltFreeExtElement); xmlHashFree(xsltElementsHash, (xmlHashDeallocator) xsltFreeExtElement);
xsltElementsHash = NULL; xsltElementsHash = NULL;
@@ -1162,7 +1162,7 @@ xsltUnregisterExtModuleTopLevel (const xmlChar *name,
* *
* Unregisters all extension module function * Unregisters all extension module function
*/ */
void static void
xsltUnregisterAllExtModuleTopLevel (void) { xsltUnregisterAllExtModuleTopLevel (void) {
xmlHashFree(xsltTopLevelsHash, NULL); xmlHashFree(xsltTopLevelsHash, NULL);
xsltTopLevelsHash = NULL; xsltTopLevelsHash = NULL;
@@ -1465,3 +1465,18 @@ xsltRegisterTestModule (void) {
xsltExtElementPreCompTest , xsltExtElementPreCompTest ,
xsltExtElementTest); xsltExtElementTest);
} }
/**
* xsltCleanupGlobals:
*
* Unregister all global variables set up by the XSLT library
*/
void
xsltCleanupGlobals(void)
{
xsltUnregisterAllExtModules();
xsltUnregisterAllExtModuleFunction();
xsltUnregisterAllExtModuleElement();
xsltUnregisterAllExtModuleTopLevel();
}

View File

@@ -80,8 +80,6 @@ int xsltRegisterExtModuleFull
int xsltUnregisterExtModule (const xmlChar * URI); int xsltUnregisterExtModule (const xmlChar * URI);
void xsltUnregisterAllExtModules(void);
void * xsltGetExtData (xsltTransformContextPtr ctxt, void * xsltGetExtData (xsltTransformContextPtr ctxt,
const xmlChar *URI); const xmlChar *URI);

View File

@@ -1249,7 +1249,7 @@ xsltGatherNamespaces(xsltStylesheetPtr style) {
/** /**
* xsltParseTemplateContent: * xsltParseTemplateContent:
* @style: the XSLT stylesheet * @style: the XSLT stylesheet
* @template: the container node (can be a document for literal results) * @templ: the container node (can be a document for literal results)
* *
* parse a template content-model * parse a template content-model
* Clean-up the template content from unwanted ignorable blank nodes * Clean-up the template content from unwanted ignorable blank nodes
@@ -1257,14 +1257,14 @@ xsltGatherNamespaces(xsltStylesheetPtr style) {
*/ */
void void
xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr template) { xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) {
xmlNodePtr cur, delete; xmlNodePtr cur, delete;
/* /*
* This content comes from the stylesheet * This content comes from the stylesheet
* For stylesheets, the set of whitespace-preserving * For stylesheets, the set of whitespace-preserving
* element names consists of just xsl:text. * element names consists of just xsl:text.
*/ */
cur = template->children; cur = templ->children;
delete = NULL; delete = NULL;
while (cur != NULL) { while (cur != NULL) {
if (delete != NULL) { if (delete != NULL) {
@@ -1362,7 +1362,7 @@ skip_children:
cur = cur->parent; cur = cur->parent;
if (cur == NULL) if (cur == NULL)
break; break;
if (cur == template) { if (cur == templ) {
cur = NULL; cur = NULL;
break; break;
} }
@@ -1385,7 +1385,7 @@ skip_children:
/* /*
* Skip the first params * Skip the first params
*/ */
cur = template->children; cur = templ->children;
while (cur != NULL) { while (cur != NULL) {
if ((IS_XSLT_ELEM(cur)) && (!(IS_XSLT_NAME(cur, "param")))) if ((IS_XSLT_ELEM(cur)) && (!(IS_XSLT_NAME(cur, "param"))))
break; break;

View File

@@ -71,6 +71,11 @@ extern const int xsltLibxsltVersion;
*/ */
extern const int xsltLibxmlVersion; extern const int xsltLibxmlVersion;
/*
* Global cleanup function
*/
void xsltCleanupGlobals (void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -455,7 +455,7 @@ xmlXPathError xsltFormatNumberConversion(xsltDecimalFormatPtr self,
xmlChar **result); xmlChar **result);
void xsltParseTemplateContent(xsltStylesheetPtr style, void xsltParseTemplateContent(xsltStylesheetPtr style,
xmlNodePtr template); xmlNodePtr templ);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -505,10 +505,7 @@ main(int argc, char **argv)
} }
xsltFreeStylesheet(cur); xsltFreeStylesheet(cur);
} }
xsltUnregisterAllExtModules(); xsltCleanupGlobals();
xsltUnregisterAllExtModuleFunction();
xsltUnregisterAllExtModuleElement();
xsltUnregisterAllExtModuleTopLevel();
xmlCleanupParser(); xmlCleanupParser();
xmlMemoryDump(); xmlMemoryDump();
return (0); return (0);