about summary refs log tree commit homepage
diff options
authorEric Wong <e@80x24.org>2016-02-23 02:04:34 +0000
committerEric Wong <e@80x24.org>2016-02-23 18:48:23 +0000
commit2a05853cfcd19514299ab99f72a8e6edcc3fcd66 (patch)
parentb30fc2616c0428713e0b4b5426485fc2c3c0c7b7 (diff)
The File.readlink has been available since the earliest SVN import
of Ruby from Jan 16 1998.  There's no reason to load the Pathname
class here since we don't do any further pathname manipulation.

So avoid loading the extra .so here and creating extra objects.
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/raindrops/linux.rb b/lib/raindrops/linux.rb
index a38fa64..4166ec7 100644
--- a/lib/raindrops/linux.rb
+++ b/lib/raindrops/linux.rb
@@ -8,7 +8,6 @@
 # Instead of snapshotting, Raindrops::Aggregate::LastDataRecv may be used
 # to aggregate statistics from +all+ accepted sockets as they arrive
 # based on the +last_data_recv+ field in Raindrops::TCP_Info
-require 'pathname'
 module Raindrops::Linux
@@ -46,7 +45,7 @@ module Raindrops::Linux
         path.force_encoding(Encoding::BINARY) if defined?(Encoding)
         if File.symlink?(path)
           link = path
-          path = Pathname.new(link).realpath.to_s
+          path = File.readlink(link)
           path.force_encoding(Encoding::BINARY) if defined?(Encoding)
           rv[link] = rv[path] # vivify ListenerStats