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
- improved subject checking
- 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 +=
from 0.0.7 to 0.0.8

View file

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

View file

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

View file

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