* [PATCH] http: simplify offset calculation slightly
@ 2016-02-27 2:14 7% Eric Wong
0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2016-02-27 2:14 UTC (permalink / raw)
To: meta
No point in comparing an empty string; length() is only
potentially expensive on big strings.
---
lib/PublicInbox/HTTP.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm
index f65deda..f1016d2 100644
--- a/lib/PublicInbox/HTTP.pm
+++ b/lib/PublicInbox/HTTP.pm
@@ -40,7 +40,7 @@ sub event_read { # called by Danga::Socket
return event_read_input($self) if defined $self->{env};
- my $off = $self->{rbuf} eq '' ? 0 : length($self->{rbuf});
+ my $off = length($self->{rbuf});
my $r = sysread($self->{sock}, $self->{rbuf}, 8192, $off);
if (defined $r) {
return $self->close if $r == 0;
--
EW
^ permalink raw reply related [relevance 7%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-02-27 2:14 7% [PATCH] http: simplify offset calculation slightly Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
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).