Skip to content

Commit

Permalink
[ruby/rdoc] Reduce matched substring allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu authored and matzbot committed Dec 5, 2023
1 parent 8bdd28d commit c0baa37
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/rdoc/parser/c.rb
Expand Up @@ -582,12 +582,12 @@ def gen_body_table file_content
| ^\s*\#\s*define\s+(\w+)\s+(\w+)
}xm) do
case
when $1
table[$3] = [:func_def, $1, $2, $~.offset(2)] if !table[$3] || table[$3][0] != :func_def
when $4
table[$6] = [:macro_def, $4, $5, $~.offset(5), $7] if !table[$6] || table[$6][0] == :macro_alias
when $8
table[$8] ||= [:macro_alias, $9]
when name = $3
table[name] = [:func_def, $1, $2, $~.offset(2)] if !(t = table[name]) || t[0] != :func_def
when name = $6
table[name] = [:macro_def, $4, $5, $~.offset(5), $7] if !(t = table[name]) || t[0] == :macro_alias
when name = $8
table[name] ||= [:macro_alias, $9]
end
end
table
Expand Down

0 comments on commit c0baa37

Please sign in to comment.