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
|
||||
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 || :
|
||||
|
||||
- name: Check for bash specific substitution in configure.ac
|
||||
|
@ -38,8 +38,9 @@ prelude: |
|
||||
13.times{
|
||||
data << data
|
||||
}
|
||||
open(wcinput, 'w'){|f| f.write data}
|
||||
File.write(wcinput, data)
|
||||
end
|
||||
at_exit {File.unlink(wcinput) rescue nil}
|
||||
end
|
||||
|
||||
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 $
|
||||
# http://www.bagley.org/~doug/shootout/
|
||||
# with help from Paul Brannan
|
||||
input = open(File.join(File.dirname($0), 'wc.input'), 'rb')
|
||||
|
||||
nl = nw = nc = 0
|
||||
while true
|
||||
tmp = input.read(4096) or break
|
||||
File.open(File.join(File.dirname($0), 'wc.input'), 'rb') do |input|
|
||||
while tmp = input.read(4096)
|
||||
data = tmp << (input.gets || "")
|
||||
nc += data.length
|
||||
nl += data.count("\n")
|
||||
((data.strip! || data).tr!("\n", " ") || data).squeeze!
|
||||
nw += data.count(" ") + 1
|
||||
end
|
||||
end
|
||||
# STDERR.puts "#{nl} #{nw} #{nc}"
|
||||
|
||||
loop_count: 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user