Jeff Trawick wrote:

>[EMAIL PROTECTED] writes:
>
>>jerenkrantz    01/09/03 23:50:52
>>
>>  Modified:    server   util_filter.c
>>  Log:
>>  The ap_add_input_filter/ap_add_output_filter functions do an O(n) scan
>>  through the list of registered filters.  This patch replaces the linear
>>  list with a hash table for better performance.
>>  Submitted by:       Brian Pane <[EMAIL PROTECTED]>
>>  Reviewed by:        Justin Erenkrantz
>>  
>>  Revision  Changes    Path
>>  1.66      +30 -10    httpd-2.0/server/util_filter.c
>>  
>>  Index: util_filter.c
>>  ===================================================================
>>  RCS file: /home/cvs/httpd-2.0/server/util_filter.c,v
>>  retrieving revision 1.65
>>  retrieving revision 1.66
>>  diff -u -r1.65 -r1.66
>>  --- util_filter.c   2001/08/30 05:25:31     1.65
>>  +++ util_filter.c   2001/09/04 06:50:52     1.66
>>  @@ -126,12 +132,26 @@
>>   
>>   static ap_filter_t *add_any_filter(const char *name, void *ctx, 
>>                                 request_rec *r, conn_rec *c, 
>>  -                              ap_filter_rec_t *frec,
>>  +                   apr_hash_t *reg_filter_set,
>>                                 ap_filter_t **r_filters,
>>                                 ap_filter_t **c_filters)
>>   {
>>  -    for (; frec != NULL; frec = frec->next) {
>>  -        if (!strcasecmp(name, frec->name)) {
>>  +    if (reg_filter_set) {
>>  +        ap_filter_rec_t *frec;
>>  +        int len = strlen(name);
>>  +        int size = len + 1;
>>  +        char name_lower[size];
>>
>
>not portable, not to mention unbounded stack size; the HP C compiler
>won't compile it (maybe a reason to keep it as-is :) )
>
>"array size must be constant expression"
>
Sorry about that; here's the more portable alternative,
if anybody wants to commit it:

   char *name_lower = apr_palloc(r ? r->pool : c->pool, size);

--Brian


Reply via email to