use << when adding stuff to strings; use concat when appending arrays to arrays

This commit is contained in:
Ward Wouts 2002-08-01 11:50:09 +00:00
parent acbaf67b65
commit a32d5581b5
4 changed files with 14 additions and 13 deletions

View file

@ -5,7 +5,9 @@ from 0.0.8 to 0.0.x
- maxfilelength check - maxfilelength check
- improved subject checking - improved subject checking
- linebuffered stdout - linebuffered stdout
- always use push when adding stuff to an array this is way more - always use push when adding stuff to an array, this is way more
efficient than +=
- always use << when adding stuff to a string, this is way more
efficient than += efficient than +=
from 0.0.7 to 0.0.8 from 0.0.7 to 0.0.8

View file

@ -365,7 +365,7 @@ def get_group_body_rest(subj, file=nil)
if file if file
list.collect{|line| file.print "#{line}\n"} list.collect{|line| file.print "#{line}\n"}
else else
result += list result.concat(list)
end end
end end
end end
@ -634,7 +634,7 @@ def _uudecode_array(data)
next if line == nil next if line == nil
next unless ((((line[0] - 32) & 077) + 2) / 3).to_i == next unless ((((line[0] - 32) & 077) + 2) / 3).to_i ==
(line.length/4).to_i (line.length/4).to_i
decode += line.unpack("u") decode.concat(line.unpack("u"))
end end
print "No \"end\" found!!!\n" print "No \"end\" found!!!\n"
@ -654,7 +654,7 @@ def uudecode_group(subj, tempdir=nil)
get_group_body_rest(subj, file) get_group_body_rest(subj, file)
mode, filename, result = uudecode(file, outfile) mode, filename, result = uudecode(file, outfile)
else else
body += get_group_body_rest(subj) body.concat(get_group_body_rest(subj))
mode, filename, result = uudecode(body) mode, filename, result = uudecode(body)
end end
return mode, filename, result return mode, filename, result
@ -890,9 +890,9 @@ def _ydecode_array(data)
special = 0 special = 0
b = (b - 64) % 256 b = (b - 64) % 256
end end
str += ((b - 42) % 256).chr str << ((b - 42) % 256).chr
} }
decode += str decode << str
end end
print "${i}: no \"=yend\" found!!!\n" print "${i}: no \"=yend\" found!!!\n"
@ -913,7 +913,7 @@ def ydecode_group(subj, tempdir=nil)
get_group_body_rest(subj, file) get_group_body_rest(subj, file)
mode, filename, result = ydecode(file, outfile) mode, filename, result = ydecode(file, outfile)
else else
body += get_group_body_rest(subj) body.concat(get_group_body_rest(subj))
mode, filename, result = ydecode(body) mode, filename, result = ydecode(body)
end end
return mode, filename, result return mode, filename, result
@ -1003,10 +1003,10 @@ def rechunk_runlist(runlist)
if x =~ /(.*)-(.*)/ if x =~ /(.*)-(.*)/
a = $1 a = $1
while ($2.to_i - a.to_i) > 200 while ($2.to_i - a.to_i) > 200
result += "#{a}-#{a.to_i+199}," result << "#{a}-#{a.to_i+199},"
a = a.to_i + 200 a = a.to_i + 200
end end
result += "#{a}-#{$2}" result << "#{a}-#{$2}"
else else
x x
end end

View file

@ -68,7 +68,6 @@ def parse(line)
"articles" => Set::IntSpan.new(articles)} "articles" => Set::IntSpan.new(articles)}
@newsrc["group"][name] = group @newsrc["group"][name] = group
#@newsrc["list"] += [ group ]
@newsrc["list"].push(group) @newsrc["list"].push(group)
end end

View file

@ -109,7 +109,7 @@ def parse_config(default = {})
while i < lines.length while i < lines.length
line = lines[i] line = lines[i]
while line.sub!(/\s*\\$/, "") != nil while line.sub!(/\s*\\$/, "") != nil
line += lines[i+1] line << lines[i+1]
i += 1 i += 1
end end
line.sub!(/\s*$/, "") line.sub!(/\s*$/, "")
@ -121,14 +121,14 @@ def parse_config(default = {})
if line =~ /(.*?)\s*\+=\s*(.*)/ if line =~ /(.*?)\s*\+=\s*(.*)/
if group == "" if group == ""
if default.has_key?($1) if default.has_key?($1)
default[$1] += $2 default[$1] << $2
else else
default[$1] = $2 default[$1] = $2
end end
else else
grouparr.collect{|g| grouparr.collect{|g|
if @config[g].has_key?($1) if @config[g].has_key?($1)
@config[g][$1] += $2 @config[g][$1] << $2
elsif default.has_key?($1) elsif default.has_key?($1)
@config[g][$1] = default[$1] + $2 @config[g][$1] = default[$1] + $2
else else