diff options
| author | Luke Kanies <luke@madstop.com> | 2008-03-21 00:39:26 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-03-21 00:39:26 -0500 |
| commit | 18320b8e3271f7d1d1702907be1ff420acfc8d2b (patch) | |
| tree | 159cde5158579fc3b0ae6e502c25b32752d7561c /lib/puppet/util | |
| parent | f6325dceb3b10c300f421f540281bbd64bdc091e (diff) | |
Found all instances of methods where split() is used without
any local variables and added a local variable -- see
http://snurl.com/21zf8. My own testing showed that this
caused memory growth to level off at a reasonable level.
Note that the link above says the problem is only with class
methods, but my own testing showed that it's any method that
meets these criteria. This is not a functional change, but
should hopefully be the last nail in the coffin of #1131.
Diffstat (limited to 'lib/puppet/util')
| -rw-r--r-- | lib/puppet/util/constant_inflector.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/util/fileparsing.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/util/tagging.rb | 3 |
3 files changed, 6 insertions, 3 deletions
diff --git a/lib/puppet/util/constant_inflector.rb b/lib/puppet/util/constant_inflector.rb index 8b083951f..eeeaa0632 100644 --- a/lib/puppet/util/constant_inflector.rb +++ b/lib/puppet/util/constant_inflector.rb @@ -5,7 +5,8 @@ # file names. module Puppet::Util::ConstantInflector def file2constant(file) - file.split("/").collect { |name| name.capitalize }.join("::").gsub(/_+(.)/) { |term| $1.capitalize } + # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com] + x = file.split("/").collect { |name| name.capitalize }.join("::").gsub(/_+(.)/) { |term| $1.capitalize } end def constant2file(constant) diff --git a/lib/puppet/util/fileparsing.rb b/lib/puppet/util/fileparsing.rb index 8e39719c8..23d02ea60 100644 --- a/lib/puppet/util/fileparsing.rb +++ b/lib/puppet/util/fileparsing.rb @@ -223,7 +223,8 @@ module Puppet::Util::FileParsing # Split text into separate lines using the record separator. def lines(text) # Remove any trailing separators, and then split based on them - text.sub(/#{self.line_separator}\Q/,'').split(self.line_separator) + # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com] + x = text.sub(/#{self.line_separator}\Q/,'').split(self.line_separator) end # Split a bunch of text into lines and then parse them individually. diff --git a/lib/puppet/util/tagging.rb b/lib/puppet/util/tagging.rb index 8a50f3458..e06e13a2c 100644 --- a/lib/puppet/util/tagging.rb +++ b/lib/puppet/util/tagging.rb @@ -16,7 +16,8 @@ module Puppet::Util::Tagging @tags << tag unless @tags.include?(tag) end - qualified.collect { |name| name.split("::") }.flatten.each { |tag| @tags << tag unless @tags.include?(tag) } + # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com] + qualified.collect { |name| x = name.split("::") }.flatten.each { |tag| @tags << tag unless @tags.include?(tag) } end # Are we tagged with the provided tag? |
