ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AnyEvent/Handle.pm
(Generate patch)

Comparing AnyEvent/lib/AnyEvent/Handle.pm (file contents):
Revision 1.236 by root, Sat May 12 23:14:29 2012 UTC vs.
Revision 1.237 by root, Tue Jul 30 23:14:32 2013 UTC

1485 1485
1486register_read_type line => sub { 1486register_read_type line => sub {
1487 my ($self, $cb, $eol) = @_; 1487 my ($self, $cb, $eol) = @_;
1488 1488
1489 if (@_ < 3) { 1489 if (@_ < 3) {
1490 # this is more than twice as fast as the generic code below 1490 # this is faster then the generic code below
1491 sub { 1491 sub {
1492 $_[0]{rbuf} =~ s/^([^\015\012]*)(\015?\012)// or return; 1492 (my $pos = index $_[0]{rbuf}, "\012") >= 0
1493 or return;
1493 1494
1495 (my $str = substr $_[0]{rbuf}, 0, $pos + 1, "") =~ s/(\015?\012)\Z// or die;
1494 $cb->($_[0], "$1", "$2"); 1496 $cb->($_[0], $str, "$1");
1495 1 1497 1
1496 } 1498 }
1497 } else { 1499 } else {
1498 $eol = quotemeta $eol unless ref $eol; 1500 $eol = quotemeta $eol unless ref $eol;
1499 $eol = qr|^(.*?)($eol)|s; 1501 $eol = qr|^(.*?)($eol)|s;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines