-
-
Notifications
You must be signed in to change notification settings - Fork 896
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
remove calls to vasprintf #2489
Conversation
Thanks for asking! This looks all great! No There's a single remaining stdc Line 276 in 1b7f259
It should be gumbo_free() instead. Or even better gumbo_alloc() and siblings could be converted to ruby_xmalloc equally.
|
@larskanis I saw that I agree it would be nice to add a feature to libgumbo to allow us to set the alloc/free functions (like |
At the moment, Gumbo isn't tied to ruby in any way, I think it makes sense to keep it that way, absent a compelling reason. Gumbo originally had a way of supporting other allocators, but it made the code worse and was removed. It makes sense to me to keep Gumbo's "public" API returning memory from the standard allocator. I don't think any of the utility functions in I'd be in favor of removing |
Ah, OK, @stevecheckoway I just saw your update and will defer to your decision if you feel strongly. Go ahead and close #2490 if you wish. |
because an upcoming commit will remove vasprintf calls from the codebase
This should allow us to delete our ancient vasprintf implementation
and update the CHANGELOG
1b7f259
to
8f48155
Compare
I've rebased after merging #2480 and so this changeset should be more readable now. |
I also kicked off the truffle CI jobs on this branch because I think this PR may break some of the patches being applied in https://github.com/oracle/truffleruby/blob/master/lib/truffle/truffle/patches/nokogiri_patches.rb https://github.com/sparklemotion/nokogiri/actions/runs/2082546265 |
@flavorjones Those runs failed, any idea of the issue? For the 3rd job it's:
It fails the same way on master (https://github.com/sparklemotion/nokogiri/runs/5800516006?check_suite_focus=true) |
What problem is this PR intended to solve?
#2481 proposed cleaning up our local implementation of
vasprintf
and using it on all platforms; however this PR takes an alternative approach of removing calls tovasprintf
in favor of usingrb_vsprintf
since we need to create Ruby String objects from all the errors being handled this way.Some nice side effects:
TruffleRuby should like this better, since Sulong was missing functionality around varargsvasprintf
at compile timeNote also that this PR is based on #2480, so that should be considered before this one.
Have you included adequate test coverage?
Yes! Some of the error handling code did not have good, or any, coverage. Test coverage has been added in this PR.
Does this change affect the behavior of either the C or the Java implementations?
No behavioral changes are being introduced.
cc @Garfield96 @stevecheckoway