httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yann Ylavic <ylavic....@gmail.com>
Subject Re: svn commit: r1698133 - in /httpd/httpd/trunk: include/httpd.h modules/http2/h2_switch.c server/protocol.c server/util.c
Date Wed, 02 Sep 2015 21:41:42 GMT
On Thu, Aug 27, 2015 at 5:06 PM, William A Rowe Jr <wrowe@rowe-clan.net> wrote:
>
> On Aug 27, 2015 7:14 AM, <icing@apache.org> wrote:
>>
>> Author: icing
>> Date: Thu Aug 27 12:13:59 2015
>> New Revision: 1698133
>>
>> URL: http://svn.apache.org/r1698133
>> Log:
>> giving ap_array_index a start parameter, adding ap_array_contains
>>
>
>>   */
>> -AP_DECLARE(int) ap_array_index(const apr_array_header_t *array, const
>> char *s);
>> +AP_DECLARE(int) ap_array_index(const apr_array_header_t *array,
>> +                               const char *s,
>> +                               apr_size_t start);
>
> You want the type of rv of _index to correspond to the start input to rv,
> no?  E.g.
>
> int n = -1, count = 0;
> while ((n = ap_array_index(arr, findtag, n + 1)) >= 0)
>     ++count;
>
> sizeof(int) does not have to equal sizeof(apr_size_t).  But for indexes I
> believe it's fine.  The alternative is apr_ssize_t for both start arg and
> rv.

Or use the same type as array->nelts: int?
The conversion from unsigned to signed and (possible) sizeof mixing
looks incorrect to me.

Also, maybe ap_array_string_index would be a better name since arrays
contain any pointer (likewise
s/ap_array_contains/ap_array_has_string/g).
We could then create new ones for other types when/if necessary (or
add them to APR by appending a single r :)

Mime
View raw message