everything related to duct tape audio suite (dtas)
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: <dtas-all@nongnu.org>
Subject: [PATCH 3/3] cleanup: avoid redundant Array conversion for escapes
Date: Mon, 13 Apr 2015 01:04:24 +0000	[thread overview]
Message-ID: <1428887064-18715-4-git-send-email-e@80x24.org> (raw)
In-Reply-To: <1428887064-18715-1-git-send-email-e@80x24.org>

We already convert xs arg to be an Array, so avoid bloating
our code with redundancy.
---
 bin/dtas-cueedit                  | 4 ++--
 lib/dtas/player.rb                | 2 +-
 lib/dtas/player/client_handler.rb | 2 +-
 lib/dtas/process.rb               | 2 +-
 lib/dtas/splitfx.rb               | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/bin/dtas-cueedit b/bin/dtas-cueedit
index a2056d3..603bf28 100755
--- a/bin/dtas-cueedit
+++ b/bin/dtas-cueedit
@@ -49,7 +49,7 @@ ARGV.each do |file|
     # avoid an expensive update if the user didn't change anything
     current = File.binread(tmp.path)
     if current == original
-      $stderr.puts "tags for #{xs(Array(file))} unchanged" if $DEBUG
+      $stderr.puts "tags for #{xs(file)} unchanged" if $DEBUG
       next
     end
 
@@ -65,7 +65,7 @@ ARGV.each do |file|
       warn err_msg(cmd, $?)
       warn "E: restoring original from backup"
       x!(*%W(metaflac --import-cuesheet-from=#{backup.path} #{file}))
-      warn "E: backup cuesheet restored, #{xs(Array(file))} unchanged"
+      warn "E: backup cuesheet restored, #{xs(file)} unchanged"
       exit(false)
     end
   ensure
diff --git a/lib/dtas/player.rb b/lib/dtas/player.rb
index ea04dca..cdf1265 100644
--- a/lib/dtas/player.rb
+++ b/lib/dtas/player.rb
@@ -60,7 +60,7 @@ class DTAS::Player # :nodoc:
   end
 
   def wall(msg)
-    __wall(xs(Array(msg)))
+    __wall(xs(msg))
   end
 
   def __wall(msg)
diff --git a/lib/dtas/player/client_handler.rb b/lib/dtas/player/client_handler.rb
index a867265..b04872b 100644
--- a/lib/dtas/player/client_handler.rb
+++ b/lib/dtas/player/client_handler.rb
@@ -535,7 +535,7 @@ module DTAS::Player::ClientHandler # :nodoc:
       begin
         sf.dump(self)
       rescue => e
-        return io.emit("ERR dumping to #{xs(Array(dest))} #{e.message}")
+        return io.emit("ERR dumping to #{xs(dest)} #{e.message}")
       end
     end
     io.emit("OK")
diff --git a/lib/dtas/process.rb b/lib/dtas/process.rb
index ab4b2d5..5be107f 100644
--- a/lib/dtas/process.rb
+++ b/lib/dtas/process.rb
@@ -99,6 +99,6 @@ module DTAS::Process # :nodoc:
     _, status = Process.waitpid2(pid)
     return res if status.success?
     return status if no_raise
-    raise RuntimeError, "`#{xs(Array(cmd))}' failed: #{status.inspect}"
+    raise RuntimeError, "`#{xs(cmd)}' failed: #{status.inspect}"
   end
 end
diff --git a/lib/dtas/splitfx.rb b/lib/dtas/splitfx.rb
index fcd0028..6271fb0 100644
--- a/lib/dtas/splitfx.rb
+++ b/lib/dtas/splitfx.rb
@@ -298,7 +298,7 @@ class DTAS::SplitFX # :nodoc:
       samples = @t2s.call(stop_time)
       prev = @tracks.last and prev.commit(samples)
     else
-      raise ArgumentError, "unknown command: #{xs(Array(cmd))}"
+      raise ArgumentError, "unknown command: #{xs(cmd)}"
     end
   end
 
-- 
EW



      parent reply	other threads:[~2015-04-13  1:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-13  1:04 [PATCH 0/3] filename escaping fixups Eric Wong
2015-04-13  1:04 ` [PATCH 1/3] xs: allow taking a string as input Eric Wong
2015-04-13  1:04 ` [PATCH 2/3] escape INFILE and related environment variables Eric Wong
2015-04-13  1:04 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://80x24.org/dtas/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1428887064-18715-4-git-send-email-e@80x24.org \
    --to=e@80x24.org \
    --cc=dtas-all@nongnu.org \
    --subject='Re: [PATCH 3/3] cleanup: avoid redundant Array conversion for escapes' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

everything related to duct tape audio suite (dtas)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://80x24.org/dtas-all
	git clone --mirror http://ou63pmih66umazou.onion/dtas-all

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 dtas-all dtas-all/ https://80x24.org/dtas-all \
		dtas-all@nongnu.org
	public-inbox-index dtas-all

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.audio.dtas
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.audio.dtas
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	../../dtas.git

AGPL code for this site: git clone http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/public-inbox.git