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 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 07DB51F7FA; Tue, 4 Nov 2014 00:07:51 +0000 (UTC) Date: Tue, 4 Nov 2014 00:07:50 +0000 From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] cleanup whitespace stripping Message-ID: <20141104000750.GA32068@dcvr.yhbt.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline List-Id: No need to make stripws a separate, single-use function --- lib/Ssoma/Git.pm | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/Ssoma/Git.pm b/lib/Ssoma/Git.pm index 2211893..244d6b3 100644 --- a/lib/Ssoma/Git.pm +++ b/lib/Ssoma/Git.pm @@ -181,17 +181,10 @@ sub simple_eq { ($cur->body eq $new->body)); } -# kills leading/trailing space in-place -sub stripws { - $_[0] =~ s/\A\s*//; - $_[0] =~ s/\s*\z//; -} - sub mid2path { my ($self, $message_id) = @_; - stripws($message_id); - $message_id =~ s/\A\z//; + $message_id =~ s/\A\s*?\s*\z//; my $hex = sha1_hex($message_id); $hex =~ /\A([a-f0-9]{2})([a-f0-9]{38})\z/i or die "BUG: not a SHA-1 hex: $hex"; -- EW