perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: [patch] C implementation of $r->content + rfc on the name
Date Mon, 19 May 2003 22:57:57 GMT
Philippe M. Chiasson wrote:

>>>Why not implement your own pflatten equivalent
>>>
>>>apr_status_t modperl_brigade_sv_flatten(pTHX_ apr_bucket_brigade *bb, SV
>>>*sv) {
>>>                                               
>>>{
>>>    apr_off_t actual;
>>>    apr_size_t total;
>>>    apr_status_t rv;
>>>
>>>    /* XXX: 1: triggers reads on unknown size buckets */
>>>    apr_brigade_length(bb, 1, &actual);
>>>    total = (apr_size_t)actual;
>>>    
>>>    return apr_brigade_flatten(bb, SvGROW(sv, total), &total);
>>>}
>>>
>>>Something like that, to at least avoid allocating the storage twice.
>>
>>right, I've missed the _length API :(
> 
> 
> And it should be used carefully, as to figure out the length of a
> brigade, all buckets with unknown length (-1), i.e. network buckets,
> will have to be read first (i.e. network reads) before their size can be
> assessed. That's why there is a 1/0 flag in _length to specify if you
> want the 'exact' size, or just the size of what's known.

I thought that since this is an input stream, chances are that 99.9% of the 
traffic will be plain HEAP buckets. POST data is always coming fully attached. 
So it should be safe to force using the length.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message