* [PATCH] cleanup whitespace stripping
@ 2014-11-04 0:07 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2014-11-04 0:07 UTC (permalink / raw)
To: meta
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<//;
- $message_id =~ s/>\z//;
+ $message_id =~ s/\A\s*<?//;
+ $message_id =~ 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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-11-04 0:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-04 0:07 [PATCH] cleanup whitespace stripping Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).