-
-
Notifications
You must be signed in to change notification settings - Fork 904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes on string XPath functions #606
Conversation
Both fixes look great. I noticed in include/libxml/xpathInternals.h:
And in Nokogiri, before your patch:
Which looks like was resulting in the string being wrapped twice. Your patch looks much better. I also ran a test to make sure that the allocation by I feel warm and fuzzy about these patches. Are you comfortable if I merge this? You mentioned you wanted some discussion first ... |
…` test if not using libxml.
I just wanted someone else to check what I did because I don't have much experience with libxml internals. I added another commit because I forgot the namespace prefix when Nokogiri.uses_libxml? is false. BTW, how can I run the tests without libxml so I can test that branch of the if's? |
use rvm or rbenv to switch to jruby
Expect some unit test errors in jruby. You'll want to run the tests against master and compare the error count. |
I cannot get it working:
|
Nokogiri invokes racc as part of the build process. When in JRuby, racc should be using the pure-ruby parser, but it appears to be invoking the C parser. You'll have to figure out what bundler and rvm/rbenv are doing. |
BTW, I tested your patches against JRuby and the tests pass. |
Great! please, merge it then if you agree. I'm still fighting with the JRuby environment, but I'm not going to let it win ;-) |
Fixes on string XPath functions
Please VERIFY and let's discuss about this. I think the fix is correct, but just in case...
The
NOKOGIRI_STR_NEW2
it's duplicating the string and thexpath->stringval
is not released becausexmlXPathFreeNodeSetList
is used at the end of theevaluate
function, and I checked the libxml source and it just releases thexmlXPathObject
struct.The second commit fixes a bug for custom XPath functions that returns strings. Currently the string is being wrapped but it might be released by the GC so at the end only garbage is returned.