Clean up temporary file, wc.input [ci skip]
This commit is contained in:
parent
92f29349d5
commit
ccd18d0557
2
.github/workflows/check_misc.yml
vendored
2
.github/workflows/check_misc.yml
vendored
@ -32,7 +32,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Check for trailing spaces
|
- name: Check for trailing spaces
|
||||||
run: |
|
run: |
|
||||||
git grep -I -n $'[\t ]$' -- '*.rb' '*.[chy]' '*.rs' && exit 1 || :
|
git grep -I -n $'[\t ]$' -- '*.rb' '*.[chy]' '*.rs' '*.yml' && exit 1 || :
|
||||||
git grep -n $'^[\t ][\t ]*$' -- '*.md' && exit 1 || :
|
git grep -n $'^[\t ][\t ]*$' -- '*.md' && exit 1 || :
|
||||||
|
|
||||||
- name: Check for bash specific substitution in configure.ac
|
- name: Check for bash specific substitution in configure.ac
|
||||||
|
@ -38,8 +38,9 @@ prelude: |
|
|||||||
13.times{
|
13.times{
|
||||||
data << data
|
data << data
|
||||||
}
|
}
|
||||||
open(wcinput, 'w'){|f| f.write data}
|
File.write(wcinput, data)
|
||||||
end
|
end
|
||||||
|
at_exit {File.unlink(wcinput) rescue nil}
|
||||||
end
|
end
|
||||||
|
|
||||||
prepare_wc_input(wc_input_base)
|
prepare_wc_input(wc_input_base)
|
||||||
@ -49,17 +50,17 @@ benchmark:
|
|||||||
# $Id: wc-ruby.code,v 1.4 2004/11/13 07:43:32 bfulgham Exp $
|
# $Id: wc-ruby.code,v 1.4 2004/11/13 07:43:32 bfulgham Exp $
|
||||||
# http://www.bagley.org/~doug/shootout/
|
# http://www.bagley.org/~doug/shootout/
|
||||||
# with help from Paul Brannan
|
# with help from Paul Brannan
|
||||||
input = open(File.join(File.dirname($0), 'wc.input'), 'rb')
|
|
||||||
|
|
||||||
nl = nw = nc = 0
|
nl = nw = nc = 0
|
||||||
while true
|
File.open(File.join(File.dirname($0), 'wc.input'), 'rb') do |input|
|
||||||
tmp = input.read(4096) or break
|
while tmp = input.read(4096)
|
||||||
data = tmp << (input.gets || "")
|
data = tmp << (input.gets || "")
|
||||||
nc += data.length
|
nc += data.length
|
||||||
nl += data.count("\n")
|
nl += data.count("\n")
|
||||||
((data.strip! || data).tr!("\n", " ") || data).squeeze!
|
((data.strip! || data).tr!("\n", " ") || data).squeeze!
|
||||||
nw += data.count(" ") + 1
|
nw += data.count(" ") + 1
|
||||||
end
|
end
|
||||||
|
end
|
||||||
# STDERR.puts "#{nl} #{nw} #{nc}"
|
# STDERR.puts "#{nl} #{nw} #{nc}"
|
||||||
|
|
||||||
loop_count: 1
|
loop_count: 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user