about summary refs log tree commit homepage
path: root/lib/PublicInbox/DSPoll.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-12-27 02:53:07 +0000
committerEric Wong <e@80x24.org>2020-12-28 23:19:50 +0000
commit0f461dcd3317f44670e2fc50346f87ff41e80127 (patch)
tree816e7f83431804824ee09d1571546aeb070350c3 /lib/PublicInbox/DSPoll.pm
parenta7794134700c855a7a4fc030720ee8901b38a5f0 (diff)
downloadpublic-inbox-0f461dcd3317f44670e2fc50346f87ff41e80127.tar.gz
Consistently returning the equivalent of pollfd.revents in a
portable manner was never worth the effort for us, as we use the
same ->event_step callback regardless of POLLIN/POLLOUT/POLLHUP.

Being a Perl, @events knows it size and we don't have to return
a maximum index for the caller to iterate on.

We can also avoid redundant integer coercion ("+0") since we
ensure everything is an IV in other places.

Finally, vec() is preferable to ("\0" x $size) for resizing
buffers because it only needs to write the extended portion
and not overwrite the entire buffer.
Diffstat (limited to 'lib/PublicInbox/DSPoll.pm')
-rw-r--r--lib/PublicInbox/DSPoll.pm3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/PublicInbox/DSPoll.pm b/lib/PublicInbox/DSPoll.pm
index 1d9b51d9..a218f695 100644
--- a/lib/PublicInbox/DSPoll.pm
+++ b/lib/PublicInbox/DSPoll.pm
@@ -45,14 +45,13 @@ sub epoll_wait {
                         my $fd = $pset[$i++];
                         my $revents = $pset[$i++] or next;
                         delete($self->{$fd}) if $self->{$fd} & EPOLLONESHOT;
-                        push @$events, [ $fd ];
+                        push @$events, $fd;
                 }
                 my $nevents = scalar @$events;
                 if ($n != $nevents) {
                         warn "BUG? poll() returned $n, but got $nevents";
                 }
         }
-        $n;
 }
 
 1;