summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2023-12-05 13:22:07 +0900
committergit <[email protected]>2023-12-05 08:48:18 +0000
commitc0baa3783f1f43072128cb90339a2d00e03dde1c (patch)
tree81514150cf3fa6ccc1f893e99b0f9f02e6acde00 /lib
parent8bdd28da74ff1242a82c2003d59fef4de9ffc331 (diff)
[ruby/rdoc] Reduce matched substring allocations
https://github.com/ruby/rdoc/commit/aaed688a97
Diffstat (limited to 'lib')
-rw-r--r--lib/rdoc/parser/c.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb
index 5695bf1acb..57d802266b 100644
--- a/lib/rdoc/parser/c.rb
+++ b/lib/rdoc/parser/c.rb
@@ -582,12 +582,12 @@ class RDoc::Parser::C < RDoc::Parser
| ^\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