httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: cvs commit: apache-apr/apr/lib apr_tables.c
Date Tue, 06 Jun 2000 00:22:05 GMT
Euh... how is this different from ap_overlap_tables() ??

The time-complexity of the algorithm below is also pretty expensive.
ap_overlap_tables() takes incredible pains to bring the operation down to
O(n log n).

-1 on this change, unless somebody can explain "why"

thx,
-g

On 6 Jun 2000 chuck@locus.apache.org wrote:
> chuck       00/06/05 17:12:05
> 
>   Modified:    apr/include apr_lib.h
>                apr/lib  apr_tables.c
>   Log:
>   added ap_replace_tables() (orig. Graham Leggett) for mod_proxy
>...
>   --- apr_tables.c	1999/07/27 18:27:59	1.1
>   +++ apr_tables.c	2000/06/06 00:12:04	1.2
>   @@ -564,6 +564,25 @@
>        return res;
>    }
>    
>   +/* overlay one table on another - keys in base
>   + * will be replaced by keys in overlay
>   + */
>   +API_EXPORT(int) ap_replace_tables(const ap_table_t *base,
>   +                                  const ap_table_t *overlay)
>   +{
>   +    ap_table_entry_t *elts = (ap_table_entry_t *) overlay->a.elts;
>   +    int i, q = 0;
>   +    const char *val;
>   + 
>   +    for (i = 0; i < overlay->a.nelts; ++i) {
>   +      val = ap_table_get(base, elts[i].key);
>   +      if (!val || strcmp(val, elts[i].val))
>   +          q = 1;
>   +      ap_table_set(base, elts[i].key, elts[i].val);
>   +    }
>   + 
>   +    return q;
>   +}                                                                               

-- 
Greg Stein, http://www.lyra.org/


Mime
View raw message