mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-08-11 20:02:42 +03:00
applied another patch from Joel Reed Daniel
* libxslt/extensions.c: applied another patch from Joel Reed Daniel
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
Sun Jan 16 00:09:11 CET 2005 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* libxslt/extensions.c: applied another patch from Joel Reed
|
||||||
|
|
||||||
Sat Jan 15 13:54:28 CET 2005 Daniel Veillard <daniel@veillard.com>
|
Sat Jan 15 13:54:28 CET 2005 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* tests/plugins/plugin.* tests/Makefile.am libxslt/extensions.c
|
* tests/plugins/plugin.* tests/Makefile.am libxslt/extensions.c
|
||||||
|
@@ -320,7 +320,7 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI)
|
|||||||
xmlModulePtr m;
|
xmlModulePtr m;
|
||||||
exsltRegisterFunction regfunc;
|
exsltRegisterFunction regfunc;
|
||||||
xmlChar *ext_name;
|
xmlChar *ext_name;
|
||||||
xmlChar module_filename[PATH_MAX];
|
char module_filename[PATH_MAX];
|
||||||
const xmlChar *ext_directory = NULL;
|
const xmlChar *ext_directory = NULL;
|
||||||
const xmlChar *protocol = NULL;
|
const xmlChar *protocol = NULL;
|
||||||
xmlChar *i, *regfunc_name;
|
xmlChar *i, *regfunc_name;
|
||||||
@@ -343,7 +343,7 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* transform extension namespace into a module name */
|
/* transform extension namespace into a module name */
|
||||||
protocol = xmlStrstr(URI, "://");
|
protocol = xmlStrstr(URI, BAD_CAST "://");
|
||||||
if (protocol == NULL) {
|
if (protocol == NULL) {
|
||||||
ext_name = xmlStrdup(URI);
|
ext_name = xmlStrdup(URI);
|
||||||
} else {
|
} else {
|
||||||
@@ -364,16 +364,36 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI)
|
|||||||
*i = '\0';
|
*i = '\0';
|
||||||
|
|
||||||
/* determine module directory */
|
/* determine module directory */
|
||||||
ext_directory = getenv(BAD_CAST "LIBXSLT_PLUGINS_PATH");
|
ext_directory = (xmlChar *) getenv("LIBXSLT_PLUGINS_PATH");
|
||||||
|
|
||||||
|
#ifdef WITH_XSLT_DEBUG_EXTENSIONS
|
||||||
|
xsltGenericDebug(xsltGenericDebugContext,
|
||||||
|
"LIBXSLT_PLUGINS_PATH is %s\n", ext_directory);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (NULL == ext_directory)
|
if (NULL == ext_directory)
|
||||||
ext_directory = LIBXSLT_DEFAULT_PLUGINS_PATH();
|
ext_directory = BAD_CAST LIBXSLT_DEFAULT_PLUGINS_PATH();
|
||||||
if (NULL == ext_directory)
|
if (NULL == ext_directory)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
/* build the module filename, and confirm the module exists */
|
/* build the module filename, and confirm the module exists */
|
||||||
xmlStrPrintf(module_filename, sizeof(module_filename), "%s/%s%s",
|
xmlStrPrintf((xmlChar *) module_filename, sizeof(module_filename),
|
||||||
|
BAD_CAST "%s/%s%s",
|
||||||
ext_directory, ext_name, LIBXML_MODULE_EXTENSION);
|
ext_directory, ext_name, LIBXML_MODULE_EXTENSION);
|
||||||
|
|
||||||
|
#ifdef WITH_XSLT_DEBUG_EXTENSIONS
|
||||||
|
xsltGenericDebug(xsltGenericDebugContext,
|
||||||
|
"Attempting to load plugin: %s for URI: %s\n",
|
||||||
|
module_filename, URI);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (1 != xmlCheckFilename(module_filename)) {
|
if (1 != xmlCheckFilename(module_filename)) {
|
||||||
|
|
||||||
|
#ifdef WITH_XSLT_DEBUG_EXTENSIONS
|
||||||
|
xsltGenericDebug(xsltGenericDebugContext,
|
||||||
|
"xmlCheckFilename failed for plugin: %s\n", module_filename);
|
||||||
|
#endif
|
||||||
|
|
||||||
xmlFree(ext_name);
|
xmlFree(ext_name);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
@@ -381,15 +401,21 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI)
|
|||||||
/* attempt to open the module */
|
/* attempt to open the module */
|
||||||
m = xmlModuleOpen(module_filename, 0);
|
m = xmlModuleOpen(module_filename, 0);
|
||||||
if (NULL == m) {
|
if (NULL == m) {
|
||||||
|
|
||||||
|
#ifdef WITH_XSLT_DEBUG_EXTENSIONS
|
||||||
|
xsltGenericDebug(xsltGenericDebugContext,
|
||||||
|
"xmlModuleOpen failed for plugin: %s\n", module_filename);
|
||||||
|
#endif
|
||||||
|
|
||||||
xmlFree(ext_name);
|
xmlFree(ext_name);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* construct initialization func name */
|
/* construct initialization func name */
|
||||||
regfunc_name = xmlStrdup(ext_name);
|
regfunc_name = xmlStrdup(ext_name);
|
||||||
regfunc_name = xmlStrcat(regfunc_name, "_init");
|
regfunc_name = xmlStrcat(regfunc_name, BAD_CAST "_init");
|
||||||
|
|
||||||
rc = xmlModuleSymbol(m, regfunc_name, (void **) ®func);
|
rc = xmlModuleSymbol(m, (const char *) regfunc_name, (void **) ®func);
|
||||||
if (0 == rc) {
|
if (0 == rc) {
|
||||||
/* call the module's init function */
|
/* call the module's init function */
|
||||||
(*regfunc) ();
|
(*regfunc) ();
|
||||||
@@ -397,6 +423,13 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI)
|
|||||||
/* register this module in our hash */
|
/* register this module in our hash */
|
||||||
xmlHashAddEntry(xsltModuleHash, URI, (void *) m);
|
xmlHashAddEntry(xsltModuleHash, URI, (void *) m);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
#ifdef WITH_XSLT_DEBUG_EXTENSIONS
|
||||||
|
xsltGenericDebug(xsltGenericDebugContext,
|
||||||
|
"xmlModuleSymbol failed for plugin: %s, regfunc: %s\n",
|
||||||
|
module_filename, regfunc_name);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* if regfunc not found unload the module immediately */
|
/* if regfunc not found unload the module immediately */
|
||||||
xmlModuleClose(m);
|
xmlModuleClose(m);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user