Ok. I will get through this.
I tried to change the imports.c code before. But it broke the execution. It
doesn't find the templates correctly. I am not sure for what reason. Do i
miss something while filling the hash table?

Thanks!

On Thu, Aug 27, 2015 at 2:32 PM, Nick Wellnhofer <[email protected]>
wrote:

> On 20/08/2015 19:21, Christian Ceelen wrote:
>
>> Ok. I think i found the answer by trial and error myself. I was not able
>> to
>> look up the named templates in the hash table for the (pre-) compiled
>> templates.
>>
>> So i followed Nick's suggest and came up with this first draft:
>> https://github.com/GNOME/libxslt/pull/1
>>
>
> Some quick comments:
>
> - It's nice that you create the hash lazily.
> - The helper function xsltHasNamedTemplate doesn't seem to be
>   necessary since it's used only once.
> - xmlHashCreate(1024) creates a hash table with 1024 initial slots.
>   This value should be reduced to something sensible like 4.
>
> I think reordering structs in xsltInternals.h doesn't break ABI
> compatibility. So `namedTemplatesHash` could be moved to the other template
> fields. But I'm not 100% sure.
>
> I tested locally and didn't get any surprises. I also created a simple test
>> with 2 named templates that have the same name to test for collision
>> detection. The new code behaves in that case as the previous one. But so
>> far I
>> have no idea yet where and how to add it to the tests in the test suite as
>> this is a test for failure detection.
>>
>
> Put your test files in:
>
> - tests/REC/test-6-2.xml
> - tests/REC/test-6-2.xsl
>
> Then run `make tests`. This will create files
>
> - tests/REC/test-6-2.out
> - tests/REC/test-6-2.err (if there's stderr output)
>
> Inspect the contents of the `.out` and `.err` files. If everything's OK,
> add them to version control.
>
> Looking at a second glance at the imports.c and xsltFindTemplate i think it
>> would be worthwhile to add the new function i created for lookup in the
>> hash
>> table in the file imports.c and try to encapsulate the behavior there. Do
>> you
>> think i should refactor the code in that direction?
>>
>
> I don't think it's necessary to add any helper functions. But please
> change the lookup code in imports.c to make use of the named templates hash.
>
> Nick
>
_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
[email protected]
https://mail.gnome.org/mailman/listinfo/xslt

Reply via email to