8000 Improve `Text.check` performance by naitoh · Pull Request #256 · ruby/rexml · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improve Text.check performance #256

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

Merged
merged 1 commit into from
May 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rexml/attribute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def element=( element )
@element = element

if @normalized
Text.check( @normalized, NEEDS_A_SECOND_CHECK, doctype )
Text.check( @normalized, NEEDS_A_SECOND_CHECK )
end

self
Expand Down
6 changes: 3 additions & 3 deletions lib/rexml/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,16 @@ def initialize(arg, respect_whitespace=false, parent=nil, raw=nil,
@entity_filter = entity_filter if entity_filter
clear_cache

Text.check(@string, illegal, doctype) if @raw
Text.check(@string, illegal) if @raw
end

def parent= parent
super(parent)
Text.check(@string, NEEDS_A_SECOND_CHECK, doctype) if @raw and @parent
Text.check(@string, NEEDS_A_SECOND_CHECK) if @raw and @parent
end

# check for illegal characters
def Text.check string, pattern, doctype
def Text.check string, pattern, doctype = nil

# illegal anywhere
if !string.match?(VALID_XML_CHARS)
Expand Down
2 changes: 1 addition & 1 deletion test/test_text_check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module REXMLTests
class TextCheckTester < Test::Unit::TestCase

def check(string)
REXML::Text.check(string, REXML::Text::NEEDS_A_SECOND_CHECK, nil)
REXML::Text.check(string, REXML::Text::NEEDS_A_SECOND_CHECK)
end

def assert_check(string)
Expand Down
0