Skip to content

Commit aaed688

Browse files
committed
Reduce matched substring allocations
1 parent 7cf353a commit aaed688

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/rdoc/parser/c.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -582,12 +582,12 @@ def gen_body_table file_content
582582
| ^\s*\#\s*define\s+(\w+)\s+(\w+)
583583
}xm) do
584584
case
585-
when $1
586-
table[$3] = [:func_def, $1, $2, $~.offset(2)] if !table[$3] || table[$3][0] != :func_def
587-
when $4
588-
table[$6] = [:macro_def, $4, $5, $~.offset(5), $7] if !table[$6] || table[$6][0] == :macro_alias
589-
when $8
590-
table[$8] ||= [:macro_alias, $9]
585+
when name = $3
586+
table[name] = [:func_def, $1, $2, $~.offset(2)] if !(t = table[name]) || t[0] != :func_def
587+
when name = $6
588+
table[name] = [:macro_def, $4, $5, $~.offset(5), $7] if !(t = table[name]) || t[0] == :macro_alias
589+
when name = $8
590+
table[name] ||= [:macro_alias, $9]
591591
end
592592
end
593593
table

0 commit comments

Comments
 (0)