geoff       2004/08/03 09:25:21

  Modified:    .        Changes
               src/modules/perl modperl_apache_compat.c
                        modperl_apache_compat.h
  Log:
  removed support for httpd 2.0.46.  httpd 2.0.47 is now the minimum
  supported version
  
  Revision  Changes    Path
  1.427     +3 -0      modperl-2.0/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.426
  retrieving revision 1.427
  diff -u -r1.426 -r1.427
  --- Changes   2 Aug 2004 18:02:27 -0000       1.426
  +++ Changes   3 Aug 2004 16:25:20 -0000       1.427
  @@ -12,6 +12,9 @@
   
   =item 1.99_15-dev
   
  +removed support for httpd 2.0.46.  httpd 2.0.47 is now the minimum
  +supported version.  [Geoffrey Young]
  +
   Static builds for httpd >= 2.0.51 available. With the new MP_AP_BUILD
   option, configure and compile an httpd with mod_perl statically linked
   in [Gozer]
  
  
  
  1.6       +6 -227    modperl-2.0/src/modules/perl/modperl_apache_compat.c
  
  Index: modperl_apache_compat.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_apache_compat.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- modperl_apache_compat.c   4 Mar 2004 06:01:06 -0000       1.5
  +++ modperl_apache_compat.c   3 Aug 2004 16:25:21 -0000       1.6
  @@ -19,231 +19,10 @@
    * BACK_COMPAT_MARKER: make back compat issues easy to find :)
    */
   
  -/* pre-APR_0_9_5 (APACHE_2_0_47)
  - * both 2.0.46 and 2.0.47 shipped with 0.9.4 -
  - * we need the one that shipped with 2.0.47,
  -   which is major mmn 20020903, minor mmn 4 */
  -#if ! AP_MODULE_MAGIC_AT_LEAST(20020903,4)
  -
  -/* added in APACHE_2_0_47/APR_0_9_4 - duplicated here for 2.0.46.
  - * I'd rather not duplicate it, but we use apr_table_compress
  - * in the directive merge routines, so it's either duplicate it
  - * here, recode the compress logic there, or drop 2.0.46 support
  +/* use the following format:
  + *     #if ! AP_MODULE_MAGIC_AT_LEAST(20020903,4)
  + *         [compat code]
  + *     #endif
  + * and don't forget to insert comments explaining exactly
  + * which httpd release allows us to remove the compat code
    */
  -
  -#define TABLE_HASH_SIZE 32
  -
  -struct apr_table_t {
  -    apr_array_header_t a;
  -#ifdef MAKE_TABLE_PROFILE
  -    /** Who created the array. */
  -    void *creator;
  -#endif
  -    apr_uint32_t index_initialized;
  -    int index_first[TABLE_HASH_SIZE];
  -    int index_last[TABLE_HASH_SIZE];
  -};
  -
  -static apr_table_entry_t **table_mergesort(apr_pool_t *pool,
  -                                           apr_table_entry_t **values, int n)
  -{
  -    /* Bottom-up mergesort, based on design in Sedgewick's "Algorithms
  -     * in C," chapter 8
  -     */
  -    apr_table_entry_t **values_tmp =
  -        (apr_table_entry_t **)apr_palloc(pool, n * sizeof(apr_table_entry_t*));
  -    int i;
  -    int blocksize;
  -
  -    /* First pass: sort pairs of elements (blocksize=1) */
  -    for (i = 0; i + 1 < n; i += 2) {
  -        if (strcasecmp(values[i]->key, values[i + 1]->key) > 0) {
  -            apr_table_entry_t *swap = values[i];
  -            values[i] = values[i + 1];
  -            values[i + 1] = swap;
  -        }
  -    }
  -
  -    /* Merge successively larger blocks */
  -    blocksize = 2;
  -    while (blocksize < n) {
  -        apr_table_entry_t **dst = values_tmp;
  -        int next_start;
  -        apr_table_entry_t **swap;
  -
  -        /* Merge consecutive pairs blocks of the next blocksize.
  -         * Within a block, elements are in sorted order due to
  -         * the previous iteration.
  -         */
  -        for (next_start = 0; next_start + blocksize < n;
  -             next_start += (blocksize + blocksize)) {
  -
  -            int block1_start = next_start;
  -            int block2_start = block1_start + blocksize;
  -            int block1_end = block2_start;
  -            int block2_end = block2_start + blocksize;
  -            if (block2_end > n) {
  -                /* The last block may be smaller than blocksize */
  -                block2_end = n;
  -            }
  -            for (;;) {
  -
  -                /* Merge the next two blocks:
  -                 * Pick the smaller of the next element from
  -                 * block 1 and the next element from block 2.
  -                 * Once either of the blocks is emptied, copy
  -                 * over all the remaining elements from the
  -                 * other block
  -                 */
  -                if (block1_start == block1_end) {
  -                    for (; block2_start < block2_end; block2_start++) {
  -                        *dst++ = values[block2_start];
  -                    }
  -                    break;
  -                }
  -                else if (block2_start == block2_end) {
  -                    for (; block1_start < block1_end; block1_start++) {
  -                        *dst++ = values[block1_start];
  -                    }
  -                    break;
  -                }
  -                if (strcasecmp(values[block1_start]->key,
  -                               values[block2_start]->key) > 0) {
  -                    *dst++ = values[block2_start++];
  -                }
  -                else {
  -                    *dst++ = values[block1_start++];
  -                }
  -            }
  -        }
  -
  -        /* If n is not a multiple of 2*blocksize, some elements
  -         * will be left over at the end of the array.
  -         */
  -        for (i = dst - values_tmp; i < n; i++) {
  -            values_tmp[i] = values[i];
  -        }
  -
  -        /* The output array of this pass becomes the input
  -         * array of the next pass, and vice versa
  -         */
  -        swap = values_tmp;
  -        values_tmp = values;
  -        values = swap;
  -
  -        blocksize += blocksize;
  -    }
  -
  -    return values;
  -}
  -void apr_table_compress(apr_table_t *t, unsigned flags)
  -{
  -    apr_table_entry_t **sort_array;
  -    apr_table_entry_t **sort_next;
  -    apr_table_entry_t **sort_end;
  -    apr_table_entry_t *table_next;
  -    apr_table_entry_t **last;
  -    int i;
  -    int dups_found;
  -
  -    if (t->a.nelts <= 1) {
  -        return;
  -    }
  -
  -    /* Copy pointers to all the table elements into an
  -     * array and sort to allow for easy detection of
  -     * duplicate keys
  -     */
  -    sort_array = (apr_table_entry_t **)
  -        apr_palloc(t->a.pool, t->a.nelts * sizeof(apr_table_entry_t*));
  -    sort_next = sort_array;
  -    table_next = (apr_table_entry_t *)t->a.elts;
  -    i = t->a.nelts;
  -    do {
  -        *sort_next++ = table_next++;
  -    } while (--i);
  -
  -    /* Note: the merge is done with mergesort instead of quicksort
  -     * because mergesort is a stable sort and runs in n*log(n)
  -     * time regardless of its inputs (quicksort is quadratic in
  -     * the worst case)
  -     */
  -    sort_array = table_mergesort(t->a.pool, sort_array, t->a.nelts);
  -
  -    /* Process any duplicate keys */
  -    dups_found = 0;
  -    sort_next = sort_array;
  -    sort_end = sort_array + t->a.nelts;
  -    last = sort_next++;
  -    while (sort_next < sort_end) {
  -        if (((*sort_next)->key_checksum == (*last)->key_checksum) &&
  -            !strcasecmp((*sort_next)->key, (*last)->key)) {
  -            apr_table_entry_t **dup_last = sort_next + 1;
  -            dups_found = 1;
  -            while ((dup_last < sort_end) &&
  -                   ((*dup_last)->key_checksum == (*last)->key_checksum) &&
  -                   !strcasecmp((*dup_last)->key, (*last)->key)) {
  -                dup_last++;
  -            }
  -            dup_last--; /* Elements from last through dup_last, inclusive,
  -                         * all have the same key
  -                         */
  -            if (flags == APR_OVERLAP_TABLES_MERGE) {
  -                apr_size_t len = 0;
  -                apr_table_entry_t **next = last;
  -                char *new_val;
  -                char *val_dst;
  -                do {
  -                    len += strlen((*next)->val);
  -                    len += 2; /* for ", " or trailing null */
  -                } while (++next <= dup_last);
  -                new_val = (char *)apr_palloc(t->a.pool, len);
  -                val_dst = new_val;
  -                next = last;
  -                for (;;) {
  -                    strcpy(val_dst, (*next)->val);
  -                    val_dst += strlen((*next)->val);
  -                    next++;
  -                    if (next > dup_last) {
  -                        *val_dst = 0;
  -                        break;
  -                    }
  -                    else {
  -                        *val_dst++ = ',';
  -                        *val_dst++ = ' ';
  -                    }
  -                }
  -                (*last)->val = new_val;
  -            }
  -            else { /* overwrite */
  -                (*last)->val = (*dup_last)->val;
  -            }
  -            do {
  -                (*sort_next)->key = NULL;
  -            } while (++sort_next <= dup_last);
  -        }
  -        else {
  -            last = sort_next++;
  -        }
  -    }
  -
  -    /* Shift elements to the left to fill holes left by removing duplicates */
  -    if (dups_found) {
  -        apr_table_entry_t *src = (apr_table_entry_t *)t->a.elts;
  -        apr_table_entry_t *dst = (apr_table_entry_t *)t->a.elts;
  -        apr_table_entry_t *last_elt = src + t->a.nelts;
  -        do {
  -            if (src->key) {
  -                *dst++ = *src;
  -            }
  -        } while (++src < last_elt);
  -        t->a.nelts -= (last_elt - dst);
  -    }
  -
  -    /* XXX mod_perl: remove to avoid more code duplication.
  -     * XXX makes us slower on 2.0.46
  -     */
  -    /* table_reindex(t); */
  -}
  -
  -#endif /* pre-APR_0_9_5 (APACHE_2_0_47) */
  
  
  
  1.5       +8 -19     modperl-2.0/src/modules/perl/modperl_apache_compat.h
  
  Index: modperl_apache_compat.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_apache_compat.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- modperl_apache_compat.h   4 Mar 2004 06:01:06 -0000       1.4
  +++ modperl_apache_compat.h   3 Aug 2004 16:25:21 -0000       1.5
  @@ -23,27 +23,16 @@
   typedef void * apr_thread_mutex_t;
   #endif
   
  -/* XXX: these backcompat macros can be deleted when we bump up the
  - * minimal supported httpd version to 2.0.47 or higher
  +/* back compat adjustements for older Apache versions
    * BACK_COMPAT_MARKER: make back compat issues easy to find :)
    */
   
  -/* pre-APR_0_9_5 (APACHE_2_0_47)
  - * both 2.0.46 and 2.0.47 shipped with 0.9.4 -
  - * we need the one that shipped with 2.0.47,
  -   which is major mmn 20020903, minor mmn 4 */
  -#if ! AP_MODULE_MAGIC_AT_LEAST(20020903,4)
  -
  -/* added in APACHE_2_0_47/APR_0_9_4 */
  -void apr_table_compress(apr_table_t *t, unsigned flags);
  -
  -#endif /* pre-APR_0_9_5 (APACHE_2_0_47) */
  -
  -#define modperl_apr_func_not_implemented(func, httpd_ver, apr_ver) \
  -    { \
  -        dTHX; \
  -        Perl_croak(aTHX_ #func "() requires httpd/" #httpd_ver \
  -                               " and apr/" #apr_ver " or higher"); \
  -    }
  +/* use the following format:
  + *     #if ! AP_MODULE_MAGIC_AT_LEAST(20020903,4)
  + *         [compat code]
  + *     #endif
  + * and don't forget to insert comments explaining exactly
  + * which httpd release allows us to remove the compat code
  + */
   
   #endif /* MODPERL_APACHE_COMPAT_H */
  
  
  

Reply via email to