stas 2004/06/01 16:36:17
Modified: t/filter/TestFilter both_str_con_add.pm in_bbs_body.pm
in_bbs_consume.pm in_bbs_msg.pm in_bbs_underrun.pm
in_init_basic.pm
t/response/TestApache discard_rbody.pm
Log:
drop error checking for (get|pass)_brigade call where they can be handled
by exceptions (i.e. when called in void context)
Revision Changes Path
1.15 +7 -13 modperl-2.0/t/filter/TestFilter/both_str_con_add.pm
Index: both_str_con_add.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/both_str_con_add.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -u -r1.14 -r1.15
--- both_str_con_add.pm 31 May 2004 07:36:10 -0000 1.14
+++ both_str_con_add.pm 1 Jun 2004 23:36:16 -0000 1.15
@@ -63,21 +63,15 @@
my $bb = APR::Brigade->new($c->pool, $c->bucket_alloc);
for (;;) {
- my $rv = $c->input_filters->get_brigade($bb, Apache::MODE_GETLINE);
- if ($rv != APR::SUCCESS && $rv != APR::EOF) {
- my $error = APR::Error::strerror($rv);
- warn __PACKAGE__ . ": get_brigade: $error\n";
- last;
- }
-
+ $c->input_filters->get_brigade($bb, Apache::MODE_GETLINE);
last if $bb->is_empty;
- # fflush is the equivalent of the following 3 lines of code:
- #
- # my $b = APR::Bucket::flush_create($c->bucket_alloc);
- # $bb->insert_tail($b);
- # $c->output_filters->pass_brigade($bb);
- $c->output_filters->fflush($bb);
+ my $b = APR::Bucket::flush_create($c->bucket_alloc);
+ $bb->insert_tail($b);
+ $c->output_filters->pass_brigade($bb);
+ # fflush is the equivalent of the previous 3 lines of code:
+ # but it's tested elsewhere, here testing flush_create
+ # $c->output_filters->fflush($bb);
}
$bb->destroy;
1.5 +1 -5 modperl-2.0/t/filter/TestFilter/in_bbs_body.pm
Index: in_bbs_body.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/in_bbs_body.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -u -r1.4 -r1.5
--- in_bbs_body.pm 21 May 2004 22:01:16 -0000 1.4
+++ in_bbs_body.pm 1 Jun 2004 23:36:16 -0000 1.5
@@ -21,11 +21,7 @@
my $ctx_bb = APR::Brigade->new($filter->r->pool, $ba);
- my $rv = $filter->next->get_brigade($ctx_bb, $mode, $block, $readbytes);
-
- if ($rv != APR::SUCCESS) {
- return $rv;
- }
+ $filter->next->get_brigade($ctx_bb, $mode, $block, $readbytes);
while (!$ctx_bb->is_empty) {
my $bucket = $ctx_bb->first;
1.4 +2 -2 modperl-2.0/t/filter/TestFilter/in_bbs_consume.pm
Index: in_bbs_consume.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/in_bbs_consume.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -u -r1.3 -r1.4
--- in_bbs_consume.pm 21 May 2004 18:40:50 -0000 1.3
+++ in_bbs_consume.pm 1 Jun 2004 23:36:16 -0000 1.4
@@ -28,7 +28,7 @@
until ($satisfied) {
my $tbb = APR::Brigade->new($filter->r->pool, $ba);
- my $rv = $filter->next->get_brigade($tbb, $mode, $block, READ_SIZE);
+ $filter->next->get_brigade($tbb, $mode, $block, READ_SIZE);
debug "asking for a bb of " . READ_SIZE . " bytes\n";
my $data;
($data, $seen_eos) = bb_data_n_eos($tbb);
@@ -40,7 +40,7 @@
# consume all the remaining input
do {
my $tbb = APR::Brigade->new($filter->r->pool, $ba);
- my $rv = $filter->next->get_brigade($tbb, $mode, $block, $readbytes);
+ $filter->next->get_brigade($tbb, $mode, $block, $readbytes);
debug "discarding the next bb";
$seen_eos = bb_data_n_eos($tbb, 1); # only scan
$tbb->destroy;
1.9 +1 -5 modperl-2.0/t/filter/TestFilter/in_bbs_msg.pm
Index: in_bbs_msg.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/in_bbs_msg.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -u -r1.8 -r1.9
--- in_bbs_msg.pm 21 May 2004 22:01:16 -0000 1.8
+++ in_bbs_msg.pm 1 Jun 2004 23:36:16 -0000 1.9
@@ -25,11 +25,7 @@
my $c = $filter->c;
my $ctx_bb = APR::Brigade->new($c->pool, $c->bucket_alloc);
- my $rv = $filter->next->get_brigade($ctx_bb, $mode, $block, $readbytes);
-
- if ($rv != APR::SUCCESS) {
- return $rv;
- }
+ $filter->next->get_brigade($ctx_bb, $mode, $block, $readbytes);
while (!$ctx_bb->is_empty) {
my $bucket = $ctx_bb->first;
1.7 +1 -1 modperl-2.0/t/filter/TestFilter/in_bbs_underrun.pm
Index: in_bbs_underrun.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/in_bbs_underrun.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -u -r1.6 -r1.7
--- in_bbs_underrun.pm 21 May 2004 18:40:50 -0000 1.6
+++ in_bbs_underrun.pm 1 Jun 2004 23:36:16 -0000 1.7
@@ -67,7 +67,7 @@
# bytes to work with
do {
my $tbb = APR::Brigade->new($filter->r->pool, $ba);
- my $rv = $filter->next->get_brigade($tbb, $mode, $block, $readbytes);
+ $filter->next->get_brigade($tbb, $mode, $block, $readbytes);
debug "asking for a bb";
($data, $seen_eos) = flatten_bb($tbb);
$tbb->destroy;
1.3 +1 -2 modperl-2.0/t/filter/TestFilter/in_init_basic.pm
Index: in_init_basic.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/in_init_basic.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -u -r1.2 -r1.3
--- in_init_basic.pm 9 May 2003 03:33:37 -0000 1.2
+++ in_init_basic.pm 1 Jun 2004 23:36:16 -0000 1.3
@@ -41,8 +41,7 @@
$filter->r->notes->set(run => $ctx->{run});
$filter->ctx($ctx);
- my $rv = $filter->next->get_brigade($bb, $mode, $block, $readbytes);
- return $rv unless $rv == APR::SUCCESS;
+ $filter->next->get_brigade($bb, $mode, $block, $readbytes);
return Apache::OK;
}
1.2 +2 -3 modperl-2.0/t/response/TestApache/discard_rbody.pm
Index: discard_rbody.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestApache/discard_rbody.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -u -r1.1 -r1.2
--- discard_rbody.pm 23 Sep 2003 02:36:45 -0000 1.1
+++ discard_rbody.pm 1 Jun 2004 23:36:16 -0000 1.2
@@ -32,9 +32,8 @@
my $filters = $r->input_filters();
my $ba = $r->connection->bucket_alloc;
my $bb = APR::Brigade->new($r->pool, $ba);
- my $rv = $filters->get_brigade($bb, Apache::MODE_READBYTES,
- APR::BLOCK_READ, IOBUFSIZE);
- die "failed to read partial data" unless $rv == APR::SUCCESS;
+ $filters->get_brigade($bb, Apache::MODE_READBYTES,
+ APR::BLOCK_READ, IOBUFSIZE);
}
elsif ($test eq 'all') {
# consume all of the request body