Removing old patch not needed proper fix is in, Daniel
This commit is contained in:
parent
a0c4ab30b7
commit
04319b94b5
264
key.patch
264
key.patch
@ -1,264 +0,0 @@
|
||||
Index: libxslt/keys.c
|
||||
===================================================================
|
||||
--- libxslt/keys.c (revision 1450)
|
||||
+++ libxslt/keys.c (revision 1451)
|
||||
@@ -393,9 +393,11 @@ xsltGetKey(xsltTransformContextPtr ctxt,
|
||||
const xmlChar *nameURI, const xmlChar *value) {
|
||||
xmlNodeSetPtr ret;
|
||||
xsltKeyTablePtr table;
|
||||
+#if 0
|
||||
#ifdef XSLT_REFACTORED_KEYCOMP
|
||||
int found = 0;
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
if ((ctxt == NULL) || (name == NULL) || (value == NULL) ||
|
||||
(ctxt->document == NULL))
|
||||
@@ -406,20 +408,23 @@ xsltGetKey(xsltTransformContextPtr ctxt,
|
||||
"Get key %s, value %s\n", name, value);
|
||||
#endif
|
||||
|
||||
+#ifdef XSLT_REFACTORED_KEYCOMP
|
||||
+ if (xsltInitAllDocKeys(ctxt))
|
||||
+ return(NULL);
|
||||
+#endif
|
||||
+
|
||||
table = (xsltKeyTablePtr) ctxt->document->keys;
|
||||
while (table != NULL) {
|
||||
if (((nameURI != NULL) == (table->nameURI != NULL)) &&
|
||||
xmlStrEqual(table->name, name) &&
|
||||
xmlStrEqual(table->nameURI, nameURI))
|
||||
{
|
||||
-#ifdef XSLT_REFACTORED_KEYCOMP
|
||||
- found = 1;
|
||||
-#endif
|
||||
ret = (xmlNodeSetPtr)xmlHashLookup(table->keys, value);
|
||||
return(ret);
|
||||
}
|
||||
table = table->next;
|
||||
}
|
||||
+#if 0
|
||||
#ifdef XSLT_REFACTORED_KEYCOMP
|
||||
if (! found) {
|
||||
xsltStylesheetPtr style = ctxt->style;
|
||||
@@ -464,6 +469,7 @@ xsltGetKey(xsltTransformContextPtr ctxt,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@@ -553,6 +559,77 @@ xsltEvalXPathKeys(xsltTransformContextPt
|
||||
}
|
||||
#endif
|
||||
|
||||
+#ifdef XSLT_REFACTORED_KEYCOMP
|
||||
+/**
|
||||
+ * xsltInitAllDocKeys:
|
||||
+ *
|
||||
+ * INTERNAL ROUTINE ONLY
|
||||
+ *
|
||||
+ * Check if any keys on the current document need to be computed
|
||||
+ */
|
||||
+int
|
||||
+xsltInitAllDocKeys(xsltTransformContextPtr ctxt)
|
||||
+{
|
||||
+ xsltStylesheetPtr style, style2;
|
||||
+ xsltKeyDefPtr keyd, keyd2;
|
||||
+ xsltKeyTablePtr table;
|
||||
+
|
||||
+ if (ctxt == NULL)
|
||||
+ return(-1);
|
||||
+
|
||||
+ if (ctxt->document->nbKeysComputed == ctxt->nbKeys)
|
||||
+ return(0);
|
||||
+ /*
|
||||
+ * TODO: This could be further optimized
|
||||
+ */
|
||||
+ style = ctxt->style;
|
||||
+ while (style) {
|
||||
+ keyd = (xsltKeyDefPtr) style->keys;
|
||||
+ while (keyd != NULL) {
|
||||
+ /*
|
||||
+ * Check if keys with this QName have been already
|
||||
+ * computed.
|
||||
+ */
|
||||
+ table = (xsltKeyTablePtr) ctxt->document->keys;
|
||||
+ while (table) {
|
||||
+ if (((keyd->nameURI != NULL) == (table->nameURI != NULL)) &&
|
||||
+ xmlStrEqual(keyd->name, table->name) &&
|
||||
+ xmlStrEqual(keyd->nameURI, table->nameURI))
|
||||
+ {
|
||||
+ break;
|
||||
+ }
|
||||
+ table = table->next;
|
||||
+ }
|
||||
+ if (table == NULL) {
|
||||
+ /*
|
||||
+ * Keys with this QName have not been yet computed.
|
||||
+ */
|
||||
+ style2 = ctxt->style;
|
||||
+ while (style2 != NULL) {
|
||||
+ keyd2 = (xsltKeyDefPtr) style2->keys;
|
||||
+ while (keyd2 != NULL) {
|
||||
+ if (((keyd2->nameURI != NULL) ==
|
||||
+ (keyd->nameURI != NULL)) &&
|
||||
+ xmlStrEqual(keyd2->name, keyd->name) &&
|
||||
+ xmlStrEqual(keyd2->nameURI, keyd->nameURI))
|
||||
+ {
|
||||
+ xsltInitCtxtKey(ctxt, ctxt->document, keyd2);
|
||||
+ if (ctxt->document->nbKeysComputed == ctxt->nbKeys)
|
||||
+ return(0);
|
||||
+ }
|
||||
+ keyd2 = keyd2->next;
|
||||
+ }
|
||||
+ style2 = xsltNextImport(style2);
|
||||
+ }
|
||||
+ }
|
||||
+ keyd = keyd->next;
|
||||
+ }
|
||||
+ style = xsltNextImport(style);
|
||||
+ }
|
||||
+ return(0);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/**
|
||||
* xsltInitCtxtKey:
|
||||
* @ctxt: an XSLT transformation context
|
||||
Index: libxslt/xsltInternals.h
|
||||
===================================================================
|
||||
--- libxslt/xsltInternals.h (revision 1450)
|
||||
+++ libxslt/xsltInternals.h (revision 1451)
|
||||
@@ -1958,7 +1958,8 @@ XSLTPUBFUN int XSLTCALL
|
||||
xsltInitCtxtKey (xsltTransformContextPtr ctxt,
|
||||
xsltDocumentPtr doc,
|
||||
xsltKeyDefPtr keyd);
|
||||
-
|
||||
+XSLTPUBFUN int XSLTCALL
|
||||
+ xsltInitAllDocKeys (xsltTransformContextPtr ctxt);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Index: libxslt/pattern.c
|
||||
===================================================================
|
||||
--- libxslt/pattern.c (revision 1450)
|
||||
+++ libxslt/pattern.c (revision 1451)
|
||||
@@ -2242,10 +2242,6 @@ xsltAddTemplate(xsltStylesheetPtr style,
|
||||
static int
|
||||
xsltComputeAllKeys(xsltTransformContextPtr ctxt, xmlNodePtr contextNode)
|
||||
{
|
||||
- xsltStylesheetPtr style, style2;
|
||||
- xsltKeyDefPtr keyd, keyd2;
|
||||
- xsltKeyTablePtr table;
|
||||
-
|
||||
if ((ctxt == NULL) || (contextNode == NULL)) {
|
||||
xsltTransformError(ctxt, NULL, ctxt->inst,
|
||||
"Internal error in xsltComputeAllKeys(): "
|
||||
@@ -2266,57 +2262,7 @@ xsltComputeAllKeys(xsltTransformContextP
|
||||
if (ctxt->document == NULL)
|
||||
return(-1);
|
||||
}
|
||||
-
|
||||
- if (ctxt->document->nbKeysComputed == ctxt->nbKeys)
|
||||
- return(0);
|
||||
- /*
|
||||
- * TODO: This could be further optimized
|
||||
- */
|
||||
- style = ctxt->style;
|
||||
- while (style) {
|
||||
- keyd = (xsltKeyDefPtr) style->keys;
|
||||
- while (keyd != NULL) {
|
||||
- /*
|
||||
- * Check if keys with this QName have been already
|
||||
- * computed.
|
||||
- */
|
||||
- table = (xsltKeyTablePtr) ctxt->document->keys;
|
||||
- while (table) {
|
||||
- if (((keyd->nameURI != NULL) == (table->nameURI != NULL)) &&
|
||||
- xmlStrEqual(keyd->name, table->name) &&
|
||||
- xmlStrEqual(keyd->nameURI, table->nameURI))
|
||||
- {
|
||||
- break;
|
||||
- }
|
||||
- table = table->next;
|
||||
- }
|
||||
- if (table == NULL) {
|
||||
- /*
|
||||
- * Keys with this QName have not been yet computed.
|
||||
- */
|
||||
- style2 = ctxt->style;
|
||||
- while (style2 != NULL) {
|
||||
- keyd2 = (xsltKeyDefPtr) style2->keys;
|
||||
- while (keyd2 != NULL) {
|
||||
- if (((keyd2->nameURI != NULL) ==
|
||||
- (keyd->nameURI != NULL)) &&
|
||||
- xmlStrEqual(keyd2->name, keyd->name) &&
|
||||
- xmlStrEqual(keyd2->nameURI, keyd->nameURI))
|
||||
- {
|
||||
- xsltInitCtxtKey(ctxt, ctxt->document, keyd2);
|
||||
- if (ctxt->document->nbKeysComputed == ctxt->nbKeys)
|
||||
- return(0);
|
||||
- }
|
||||
- keyd2 = keyd2->next;
|
||||
- }
|
||||
- style2 = xsltNextImport(style2);
|
||||
- }
|
||||
- }
|
||||
- keyd = keyd->next;
|
||||
- }
|
||||
- style = xsltNextImport(style);
|
||||
- }
|
||||
- return(0);
|
||||
+ return xsltInitAllDocKeys(ctxt);
|
||||
|
||||
doc_info_mismatch:
|
||||
xsltTransformError(ctxt, NULL, ctxt->inst,
|
||||
--- python/libxslt-py.c.orig 2008-04-28 17:25:21.000000000 +0200
|
||||
+++ python/libxslt-py.c 2008-04-08 19:18:45.000000000 +0200
|
||||
@@ -1639,6 +1639,22 @@ libxslt_xsltRegisterTmpRVT(PyObject *sel
|
||||
}
|
||||
|
||||
PyObject *
|
||||
+libxslt_xsltInitAllDocKeys(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||
+ PyObject *py_retval;
|
||||
+ int c_retval;
|
||||
+ xsltTransformContextPtr ctxt;
|
||||
+ PyObject *pyobj_ctxt;
|
||||
+
|
||||
+ if (!PyArg_ParseTuple(args, (char *)"O:xsltInitAllDocKeys", &pyobj_ctxt))
|
||||
+ return(NULL);
|
||||
+ ctxt = (xsltTransformContextPtr) PytransformCtxt_Get(pyobj_ctxt);
|
||||
+
|
||||
+ c_retval = xsltInitAllDocKeys(ctxt);
|
||||
+ py_retval = libxml_intWrap((int) c_retval);
|
||||
+ return(py_retval);
|
||||
+}
|
||||
+
|
||||
+PyObject *
|
||||
libxslt_xsltPrintErrorContext(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||
xsltTransformContextPtr ctxt;
|
||||
PyObject *pyobj_ctxt;
|
||||
--- doc/libxslt-api.xml.orig 2008-04-28 17:24:55.000000000 +0200
|
||||
+++ doc/libxslt-api.xml 2008-04-08 19:18:48.000000000 +0200
|
||||
@@ -529,6 +529,7 @@
|
||||
<exports symbol='xsltAllocateExtra' type='function'/>
|
||||
<exports symbol='xsltParseSequenceConstructor' type='function'/>
|
||||
<exports symbol='xsltRegisterTmpRVT' type='function'/>
|
||||
+ <exports symbol='xsltInitAllDocKeys' type='function'/>
|
||||
<exports symbol='xsltExtensionInstructionResultFinalize' type='function'/>
|
||||
<exports symbol='xsltPointerListFree' type='function'/>
|
||||
<exports symbol='xsltIsBlank' type='function'/>
|
||||
@@ -2337,6 +2338,11 @@ exits'/>
|
||||
<info>Initializes the processor (e.g. registers built-in extensions, etc.)</info>
|
||||
<return type='void'/>
|
||||
</function>
|
||||
+ <function name='xsltInitAllDocKeys' file='xsltInternals'>
|
||||
+ <info>INTERNAL ROUTINE ONLY Check if any keys on the current document need to be computed</info>
|
||||
+ <return type='int' info=''/>
|
||||
+ <arg name='ctxt' type='xsltTransformContextPtr' info=''/>
|
||||
+ </function>
|
||||
<function name='xsltInitCtxtExts' file='extensions'>
|
||||
<info>Initialize the set of modules with registered stylesheet data</info>
|
||||
<return type='int' info='the number of modules initialized or -1 in case of error'/>
|
Loading…
Reference in New Issue
Block a user