Skip to content
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

Inline HtmlTokenizer in this gem #89

Merged
merged 2 commits into from
Aug 15, 2022
Merged

Conversation

rafaelfranca
Copy link
Member

This gem is the only user of that library, so it is better to inline here than to depend on a separate gem that we also have to maintain.

@rafaelfranca
Copy link
Member Author

@flavorjones Since I'm not really good in creating C extension, I'm asking your review here.

@@ -21,17 +21,17 @@ Gem::Specification.new do |s|
"allowed_push_host" => "https://rubygems.org"
}

s.extensions = ['ext/better_html_ext/extconf.rb']
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this is enough to tell Rubygems to build the extension after the gem is released, but I think so.

s.files = Dir["{app,config,db,lib,ext}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["test/**/*"]
s.require_paths = ["lib"]
s.require_paths = ["lib", "ext"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I need this? I think the .so file moves to lib.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed a commit removing it

@@ -0,0 +1,2 @@
#include <ruby.h>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I completely forgot C, but I think I don't need this include here do I?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, not needed because ruby.h is included in the C source files

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed a commit removing it

Comment on lines +3 to +5
$CXXFLAGS += " -std=c++11 "
$CXXFLAGS += " -g -O1 -ggdb "
$CFLAGS += " -g -O1 -ggdb "
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I need this here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it was there in the previous gem, best to leave it. I don't usually like to keep debugging info in a production gem but the small codebase size here means it likely doesn't make much of a difference. And the -O1 will generally yield better performance.

Copy link
Contributor

@flavorjones flavorjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a commit with some small changes. Feel free to squash.

@flavorjones
Copy link
Contributor

Failing tests are from master, fix is at #90

@remvee
Copy link
Contributor

remvee commented Aug 15, 2022

See also: #86

rafaelfranca and others added 2 commits August 15, 2022 15:21
This gem is the only user of that library, so it is better to inline
here than to depend on a separate gem that we also have to maintain.
- remove unneeded require path from gemspec
- remove unneeded ruby.h include from better_html.h
- fix the C function parameters for Parser#errors, removing unused
  parameter that is generating warnings
@rafaelfranca rafaelfranca merged commit e77a3ca into master Aug 15, 2022
@flavorjones flavorjones deleted the rm-inline-html-tokenizer branch August 15, 2022 16:42
@shopify-shipit shopify-shipit bot temporarily deployed to rubygems August 16, 2022 14:43 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants