httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <trawi...@bellsouth.net>
Subject Re: cvs commit: apache-2.0/src/main http_protocol.c
Date Fri, 13 Oct 2000 12:30:39 GMT
Greg Stein <gstein@lyra.org> writes:

> On Fri, Oct 13, 2000 at 03:12:54AM -0000, trawick@locus.apache.org wrote:
> >...
> >   +        total = 0;
> >   +        do {
> >   +            rv = b->read(b, &tempbuf, &len_read, 0);
> >   +            if (len_to_read < b->length) { /* shouldn't happen */
> >   +                b->split(b, len_to_read);
> 
> Where to from here? You don't break out of the loop or anything...
> 
> Assert that it won't happen (and don't handle it), or actually handle the
> darn thing.
> 
> IMO, don't handle it. An alternative would be to insert:
> 
> #ifdef AP_DEBUG
>   if (len_to_read < len_read) abort();
> #endif

Better yet (IMHO), introduce ap_debug_assert(), which is like
ap_assert() but only enabled if AP_DEBUG is defined.

(Another Greg and I were talking about such a macro a few days ago...
We'd like to sprinkle something like ap_assert() around some of this
new code, but not with a performance penalty which might make folks
want to remove them later.  assertions are very useful long-term as
a form of documentation.)

> (and note the len_read rather than b->length)

oh, yeah :)

Thanks a bunch,
-- 
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
     http://www.geocities.com/SiliconValley/Park/9289/
          Born in Roswell... married an alien...

Mime
View raw message