From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.8 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, URIBL_BLOCKED shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: raindrops-public@bogomips.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id BC09820455; Tue, 23 Feb 2016 02:04:34 +0000 (UTC) Date: Tue, 23 Feb 2016 02:04:34 +0000 From: Eric Wong To: raindrops-public@bogomips.org Cc: Antonio Terceiro Subject: [RFC 2/1] linux: remove Pathname stdlib dependency Message-ID: <20160223020434.GA9948@dcvr.yhbt.net> References: <20160202183136.21549-1-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160202183136.21549-1-e@80x24.org> List-Id: 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. --- Noticed while reviewing "[RFC] linux: workaround Ruby 2.3 change" http://bogomips.org/raindrops-public/20160202183136.21549-1-e@80x24.org/raw lib/raindrops/linux.rb | 3 +-- 1 file changed, 1 insertion(+), 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 else -- EW