Skip to content

Commit 0d1ec96

Browse files
committed
performance: do not need to escape the same string value twice
1 parent d4ea2cf commit 0d1ec96

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/ruby-debug-ide/xml_printer.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,11 @@ def print_variable(name, value, kind)
172172
end
173173
value_str = handle_binary_data(value_str)
174174
compact_value_str = build_compact_name(value_str, value)
175+
escaped_value_str = CGI.escapeHTML(value_str)
175176
print("<variable name=\"%s\" compactValue=\"%s\" kind=\"%s\" value=\"%s\" type=\"%s\" hasChildren=\"%s\" objectId=\"%#+x\">",
176-
CGI.escapeHTML(name), CGI.escapeHTML(compact_value_str), kind, CGI.escapeHTML(value_str), value.class,
177+
CGI.escapeHTML(name), CGI.escapeHTML(compact_value_str), kind, escaped_value_str, value.class,
177178
has_children, value.respond_to?(:object_id) ? value.object_id : value.id)
178-
print("<value><![CDATA[%s]]></value>", CGI.escapeHTML(value_str))
179+
print("<value><![CDATA[%s]]></value>", escaped_value_str)
179180
print('</variable>')
180181
end
181182

0 commit comments

Comments
 (0)