httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@locus.apache.org
Subject cvs commit: apache-2.0/src/modules/standard mod_include.c
Date Sun, 15 Oct 2000 18:15:13 GMT
rbb         00/10/15 11:15:13

  Modified:    src/ap   ap_buckets.c ap_buckets_eos.c ap_buckets_file.c
                        ap_buckets_heap.c ap_buckets_mmap.c
                        ap_buckets_pipe.c ap_buckets_simple.c
                        ap_buckets_socket.c
               src/include ap_buckets.h
               src/main http_core.c http_protocol.c util_filter.c
               src/modules/experimental mod_charset_lite.c
               src/modules/standard mod_include.c
  Log:
  Stop using the index into the array for the bucket type.  Now we just use
  a pointer to a static structure.  The ap_foo_type functions have also been
  replaced with simple macro calls.  I am going to replace the
  ap_bucket_(read|split|setaside|destroy) functions with macros soon.
  Reviewed by:	Will Rowe
  
  Revision  Changes    Path
  1.22      +21 -25    apache-2.0/src/ap/ap_buckets.c
  
  Index: ap_buckets.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_buckets.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ap_buckets.c	2000/10/13 05:35:52	1.21
  +++ ap_buckets.c	2000/10/15 18:15:08	1.22
  @@ -66,10 +66,7 @@
   
   API_EXPORT(apr_status_t) ap_bucket_destroy(ap_bucket *e)
   {
  -    ap_bucket_type *type = (ap_bucket_type *)bucket_types->elts;
  -    if (type[e->type].destroy) {
  -        type[e->type].destroy(e->data);
  -    }
  +    e->type->destroy(e->data);
       free(e);
       return APR_SUCCESS;
   }
  @@ -77,29 +74,17 @@
   API_EXPORT(apr_status_t) ap_bucket_read(ap_bucket *e, const char **str, 
                                           apr_ssize_t *len, int block)
   {
  -    ap_bucket_type *type = (ap_bucket_type *)bucket_types->elts;
  -    if (type[e->type].read) {
  -        return type[e->type].read(e, str, len, block);
  -    }
  -    return APR_ENOTIMPL;
  +    return e->type->read(e, str, len, block);
   }
   
   API_EXPORT(apr_status_t) ap_bucket_setaside(ap_bucket *e)
   {
  -    ap_bucket_type *type = (ap_bucket_type *)bucket_types->elts;
  -    if (type[e->type].setaside) {
  -        return type[e->type].setaside(e);
  -    }
  -    return APR_ENOTIMPL;
  +    return e->type->setaside(e);
   }
   
   API_EXPORT(apr_status_t) ap_bucket_split(ap_bucket *e, apr_off_t point)
   {
  -    ap_bucket_type *type = (ap_bucket_type *)bucket_types->elts;
  -    if (type[e->type].split) {
  -        return type[e->type].split(e, point);
  -    }
  -    return APR_ENOTIMPL;
  +    return e->type->split(e, point);
   }
   
   static apr_status_t ap_brigade_cleanup(void *data)
  @@ -243,7 +228,7 @@
   
   void ap_init_bucket_types(apr_pool_t *p)
   {
  -    bucket_types = apr_make_array(p, 1, sizeof(ap_bucket_type));
  +    bucket_types = apr_make_array(p, 8, sizeof(ap_bucket_type));
       ap_bucket_heap_register(p);
       ap_bucket_transient_register(p);
       ap_bucket_file_register(p);
  @@ -256,13 +241,24 @@
   
   int ap_insert_bucket_type(ap_bucket_type *type)
   {
  -    ap_bucket_type *newone = (ap_bucket_type *)apr_push_array(bucket_types);
  +    ap_bucket_type **newone = (ap_bucket_type **)apr_push_array(bucket_types);
   
  -    newone->read = type->read;
  -    newone->setaside = type->setaside;
  -    newone->destroy = type->destroy;
  -    newone->split = type->split;
  +    newone = &type;
   
       return bucket_types->nelts - 1;
   }
   
  +API_EXPORT(apr_status_t) ap_bucket_setaside_notimpl(ap_bucket *data)
  +{
  +    return APR_ENOTIMPL;
  +}
  +
  +API_EXPORT(apr_status_t) ap_bucket_split_notimpl(ap_bucket *data, apr_off_t point)
  +{
  +    return APR_ENOTIMPL;
  +}
  +
  +API_EXPORT(void) ap_bucket_destroy_notimpl(void *data)
  +{
  +    return;
  +}
  
  
  
  1.8       +5 -14     apache-2.0/src/ap/ap_buckets_eos.c
  
  Index: ap_buckets_eos.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_buckets_eos.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ap_buckets_eos.c	2000/10/13 05:35:52	1.7
  +++ ap_buckets_eos.c	2000/10/15 18:15:09	1.8
  @@ -56,8 +56,6 @@
   #include "ap_buckets.h"
   #include <stdlib.h>
   
  -static int eos_type;
  -
   static apr_status_t eos_read(ap_bucket *b, const char **str, 
                                   apr_ssize_t *len, int block)
   {
  @@ -66,12 +64,15 @@
       return APR_SUCCESS;
   }
   
  +ap_bucket_type ap_eos_type = { "EOS", 4, ap_bucket_destroy_notimpl, eos_read,
  +                          ap_bucket_setaside_notimpl, ap_bucket_split_notimpl };
  +
   API_EXPORT(ap_bucket *) ap_bucket_make_eos(ap_bucket *b)
   {
       b->length    = AP_END_OF_BRIGADE;
       b->data      = NULL;
   
  -    b->type      = eos_type;
  +    b->type      = &ap_eos_type;
       
       return b;
   }
  @@ -83,16 +84,6 @@
   
   void ap_bucket_eos_register(apr_pool_t *p)
   {
  -    ap_bucket_type type;
  -    type.read      = eos_read;
  -    type.setaside  = NULL;
  -    type.split     = NULL;
  -    type.destroy   = NULL;
  -
  -    eos_type = ap_insert_bucket_type(&type);
  +    ap_insert_bucket_type(&ap_eos_type);
   }
   
  -int ap_eos_type(void)
  -{
  -    return eos_type;
  -}
  
  
  
  1.4       +5 -16     apache-2.0/src/ap/ap_buckets_file.c
  
  Index: ap_buckets_file.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_buckets_file.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ap_buckets_file.c	2000/10/13 05:35:53	1.3
  +++ ap_buckets_file.c	2000/10/15 18:15:09	1.4
  @@ -57,8 +57,6 @@
   #include "ap_buckets.h"
   #include <stdlib.h>
   
  -static int file_type;
  -
   /* XXX: We should obey the block flag */
   static apr_status_t file_read(ap_bucket *e, const char **str,
   			      apr_ssize_t *len, int block)
  @@ -110,6 +108,9 @@
       return APR_SUCCESS;
   }
   
  +ap_bucket_type ap_file_type = { "FILE", 4, ap_bucket_destroy_notimpl, file_read,
  +                          ap_bucket_setaside_notimpl, ap_bucket_split_notimpl };
  +
   API_EXPORT(ap_bucket *) ap_bucket_make_file(ap_bucket *b, apr_file_t *fd,
                                               apr_off_t offset, apr_size_t len)
   {
  @@ -123,7 +124,7 @@
       f->fd = fd;
       f->offset = offset;
   
  -    b->type = file_type;
  +    b->type = &ap_file_type;
       b->data = f;
       b->length = len;
   
  @@ -136,19 +137,7 @@
   }
   
   void ap_bucket_file_register(apr_pool_t *p)
  -{
  -    ap_bucket_type type;
  -
  -    type.destroy = NULL;
  -    type.read = file_read;
  -    type.setaside = NULL;
  -    type.split = NULL;
  -
  -    file_type = ap_insert_bucket_type(&type);
  -}
  -
  -int ap_file_type(void)
   {
  -    return file_type;
  +    ap_insert_bucket_type(&ap_file_type);
   }
   
  
  
  
  1.12      +5 -14     apache-2.0/src/ap/ap_buckets_heap.c
  
  Index: ap_buckets_heap.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_buckets_heap.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ap_buckets_heap.c	2000/10/13 05:35:53	1.11
  +++ ap_buckets_heap.c	2000/10/15 18:15:09	1.12
  @@ -56,7 +56,6 @@
   #include "ap_buckets.h"
   #include <stdlib.h>
   
  -static int heap_type;
   /*
    * The size of heap bucket memory allocations.
    * XXX: This is currently a guess and should be adjusted to an
  @@ -89,6 +88,9 @@
       free(h);
   }
   
  +ap_bucket_type ap_heap_type = { "HEAP", 4, heap_destroy, heap_read,
  +                          ap_bucket_setaside_notimpl, ap_bucket_split_shared };
  +
   API_EXPORT(ap_bucket *) ap_bucket_make_heap(ap_bucket *b,
   		const char *buf, apr_size_t length, int copy, apr_ssize_t *w)
   {
  @@ -128,7 +130,7 @@
   	return NULL;
       }
   
  -    b->type     = heap_type;
  +    b->type = &ap_heap_type;
   
       if (w)
           *w = length;
  @@ -144,17 +146,6 @@
   
   void ap_bucket_heap_register(apr_pool_t *p)
   {
  -    ap_bucket_type type;
  -
  -    type.split    = ap_bucket_split_shared;
  -    type.destroy  = heap_destroy;
  -    type.read     = heap_read;
  -    type.setaside = NULL;
  -
  -    heap_type = ap_insert_bucket_type(&type);
  +    ap_insert_bucket_type(&ap_heap_type);
   }
   
  -int ap_heap_type(void)
  -{
  -    return heap_type;
  -}
  
  
  
  1.12      +5 -14     apache-2.0/src/ap/ap_buckets_mmap.c
  
  Index: ap_buckets_mmap.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_buckets_mmap.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ap_buckets_mmap.c	2000/10/13 05:35:53	1.11
  +++ ap_buckets_mmap.c	2000/10/15 18:15:09	1.12
  @@ -56,8 +56,6 @@
   #include "ap_buckets.h"
   #include <stdlib.h>
   
  -static int mmap_type;
  -
   static apr_status_t mmap_read(ap_bucket *b, const char **str, 
   			      apr_ssize_t *length, int block)
   {
  @@ -86,6 +84,9 @@
       free(m);
   }
   
  +ap_bucket_type ap_mmap_type = { "MMAP", 4, mmap_destroy, mmap_read,
  +                          ap_bucket_setaside_notimpl, ap_bucket_split_shared };
  +
   /*
    * XXX: are the start and length arguments useful?
    */
  @@ -106,7 +107,7 @@
   	return NULL;
       }
   
  -    b->type     = mmap_type;
  +    b->type     = &ap_mmap_type;
   
       return b;
   }
  @@ -120,16 +121,6 @@
   
   void ap_bucket_mmap_register(apr_pool_t *p)
   {
  -    ap_bucket_type type;
  -    type.split    = ap_bucket_split_shared;
  -    type.destroy  = mmap_destroy;
  -    type.read     = mmap_read;
  -    type.setaside = NULL;
  -
  -    mmap_type = ap_insert_bucket_type(&type);
  +    ap_insert_bucket_type(&ap_mmap_type);
   }
   
  -int ap_mmap_type(void)
  -{
  -    return mmap_type;
  -}
  
  
  
  1.13      +5 -15     apache-2.0/src/ap/ap_buckets_pipe.c
  
  Index: ap_buckets_pipe.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_buckets_pipe.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ap_buckets_pipe.c	2000/10/13 05:35:53	1.12
  +++ ap_buckets_pipe.c	2000/10/15 18:15:09	1.13
  @@ -57,8 +57,6 @@
   #include "ap_buckets.h"
   #include <stdlib.h>
   
  -static int pipe_type;
  -
   /* XXX: We should obey the block flag */
   static apr_status_t pipe_read(ap_bucket *a, const char **str,
   			      apr_ssize_t *len, int block)
  @@ -99,6 +97,9 @@
       return APR_SUCCESS;
   }
   
  +ap_bucket_type ap_pipe_type = { "PIPE", 4, ap_bucket_destroy_notimpl, pipe_read,
  +                          ap_bucket_setaside_notimpl, ap_bucket_split_notimpl };
  +
   API_EXPORT(ap_bucket *) ap_bucket_make_pipe(ap_bucket *b, apr_file_t *p)
   {
       /*
  @@ -114,7 +115,7 @@
        * stream so the bucket(s) that it sets aside will be the heap
        * buckets created by pipe_read() above.
        */
  -    b->type     = pipe_type;
  +    b->type     = &ap_pipe_type;
       b->length   = -1;
       b->data     = p;
   
  @@ -128,17 +129,6 @@
   
   void ap_bucket_pipe_register(apr_pool_t *p)
   {
  -    ap_bucket_type type;
  -
  -    type.setaside = NULL;
  -    type.destroy  = NULL;
  -    type.split    = NULL;
  -    type.read     = pipe_read;
  -
  -    pipe_type = ap_insert_bucket_type(&type);
  +    ap_insert_bucket_type(&ap_pipe_type);
   }
   
  -int ap_pipe_type(void)
  -{
  -    return pipe_type;
  -}
  
  
  
  1.8       +10 -30    apache-2.0/src/ap/ap_buckets_simple.c
  
  Index: ap_buckets_simple.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_buckets_simple.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ap_buckets_simple.c	2000/10/13 19:40:50	1.7
  +++ ap_buckets_simple.c	2000/10/15 18:15:09	1.8
  @@ -57,9 +57,6 @@
   #include "ap_buckets.h"
   #include <stdlib.h>
   
  -static int immortal_type;
  -static int transient_type;
  -
   /*
    * We can't simplify this function by using an ap_bucket_make function
    * because we aren't sure of the exact type of this bucket.
  @@ -106,6 +103,9 @@
       return APR_SUCCESS;
   }
   
  +ap_bucket_type ap_immortal_type = { "IMMORTAL", 4, free, simple_read,
  +                          ap_bucket_setaside_notimpl, simple_split };
  +
   API_EXPORT(ap_bucket *) ap_bucket_make_immortal(ap_bucket *b,
   		const char *buf, apr_size_t length)
   {
  @@ -119,7 +119,7 @@
       bd->start   = buf;
       bd->end     = buf+length;
   
  -    b->type     = immortal_type;
  +    b->type     = &ap_immortal_type;
       b->length   = length;
       b->data     = bd;
   
  @@ -133,20 +133,8 @@
   }
   
   void ap_bucket_immortal_register(apr_pool_t *p)
  -{
  -    ap_bucket_type type;
  -
  -    type.setaside = NULL;
  -    type.destroy  = free;
  -    type.split    = simple_split;
  -    type.read     = simple_read;
  -
  -    immortal_type = ap_insert_bucket_type(&type);
  -}
  -
  -int ap_immortal_type(void)
   {
  -    return immortal_type;
  +    ap_insert_bucket_type(&ap_immortal_type);
   }
   
   /*
  @@ -176,6 +164,9 @@
       return APR_SUCCESS;
   }
   
  +ap_bucket_type ap_transient_type = { "TRANSIENT", 4, ap_bucket_destroy_notimpl, 
  +                                simple_read, transient_setaside, simple_split };
  +
   API_EXPORT(ap_bucket *) ap_bucket_make_transient(ap_bucket *b,
   		const char *buf, apr_size_t length)
   {
  @@ -183,7 +174,7 @@
       if (b == NULL) {
   	return NULL;
       }
  -    b->type = transient_type;
  +    b->type = &ap_transient_type;
       return b;
   }
   
  @@ -195,17 +186,6 @@
   
   void ap_bucket_transient_register(apr_pool_t *p)
   {
  -    ap_bucket_type type;
  -
  -    type.destroy = NULL;
  -    type.read = simple_read;
  -    type.setaside = transient_setaside;
  -    type.split = simple_split;
  -
  -    transient_type = ap_insert_bucket_type(&type);
  +    ap_insert_bucket_type(&ap_transient_type);
   }
   
  -int ap_transient_type(void)
  -{
  -    return transient_type;
  -}
  
  
  
  1.3       +6 -15     apache-2.0/src/ap/ap_buckets_socket.c
  
  Index: ap_buckets_socket.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_buckets_socket.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ap_buckets_socket.c	2000/10/13 05:35:53	1.2
  +++ ap_buckets_socket.c	2000/10/15 18:15:09	1.3
  @@ -57,8 +57,6 @@
   #include "ap_buckets.h"
   #include <stdlib.h>
   
  -static int socket_type;
  -
   /* XXX: We should obey the block flag */
   static apr_status_t socket_read(ap_bucket *a, const char **str,
   			      apr_ssize_t *len, int block)
  @@ -99,6 +97,10 @@
       return APR_SUCCESS;
   }
   
  +ap_bucket_type ap_socket_type = { "SOCKET", 4, ap_bucket_destroy_notimpl, 
  +                          socket_read, ap_bucket_setaside_notimpl, 
  +                          ap_bucket_split_notimpl };
  +
   API_EXPORT(ap_bucket *) ap_bucket_make_socket(ap_bucket *b, apr_socket_t *p)
   {
       /*
  @@ -109,7 +111,7 @@
        * Note that typically the socket is allocated from the connection pool
        * so it will disappear when the connection is finished. 
        */
  -    b->type     = socket_type;
  +    b->type     = &ap_socket_type;
       b->length   = -1;
       b->data     = p;
   
  @@ -123,17 +125,6 @@
   
   void ap_bucket_socket_register(apr_pool_t *p)
   {
  -    ap_bucket_type type;
  -
  -    type.setaside = NULL;
  -    type.destroy  = NULL;
  -    type.split    = NULL;
  -    type.read     = socket_read;
  - 
  -    socket_type = ap_insert_bucket_type(&type);
  +    ap_insert_bucket_type(&ap_socket_type);
   }
   
  -int ap_socket_type(void)
  -{
  -    return socket_type;
  -}
  
  
  
  1.36      +59 -34    apache-2.0/src/include/ap_buckets.h
  
  Index: ap_buckets.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/ap_buckets.h,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- ap_buckets.h	2000/10/13 05:35:55	1.35
  +++ ap_buckets.h	2000/10/15 18:15:10	1.36
  @@ -131,34 +131,18 @@
   
   typedef struct ap_bucket ap_bucket;
   
  -/**
  - * ap_bucket_t structures are allocated on the malloc() heap and
  - * their lifetime is controlled by the parent ap_brigade_t
  - * structure. Buckets can move from one brigade to another e.g. by
  - * calling ap_brigade_concat(). In general the data in a bucket has
  - * the same lifetime as the bucket and is freed when the bucket is
  - * destroyed; if the data is shared by more than one bucket (e.g.
  - * after a split) the data is freed when the last bucket goes away.
  - */
  -struct ap_bucket {
  -    /** Links to the rest of the brigade */
  -    AP_RING_ENTRY(ap_bucket) link;
  -    /** The type of bucket.  These types can be found in the enumerated
  -     *  type above */
  -    int type;
  -    /** type-dependent data hangs off this pointer */
  -    void *data;	
  -    /** The length of the data in the bucket.  This could have been implemented
  -     *  with a function, but this is an optimization, because the most
  -     *  common thing to do will be to get the length.  If the length is unknown,
  -     *  the value of this field will be -1.
  -     */
  -    apr_off_t length;
  -};
  -
   typedef struct ap_bucket_type ap_bucket_type;
   struct ap_bucket_type {
       /**
  +     * The name of the bucket type
  +     */
  +    char *name;
  +    /** 
  +     * The number of functions this bucket understands.  Can not be less than
  +     * four.
  +     */
  +    int num_func;
  +    /**
        * Free the private data and any resources used by the bucket
        * (if they aren't shared with another bucket).
        * @param data The private data pointer from the bucket to be destroyed
  @@ -193,6 +177,31 @@
       apr_status_t (*split)(ap_bucket *e, apr_off_t point);
   };
   
  +/**
  + * ap_bucket_t structures are allocated on the malloc() heap and
  + * their lifetime is controlled by the parent ap_brigade_t
  + * structure. Buckets can move from one brigade to another e.g. by
  + * calling ap_brigade_concat(). In general the data in a bucket has
  + * the same lifetime as the bucket and is freed when the bucket is
  + * destroyed; if the data is shared by more than one bucket (e.g.
  + * after a split) the data is freed when the last bucket goes away.
  + */
  +struct ap_bucket {
  +    /** Links to the rest of the brigade */
  +    AP_RING_ENTRY(ap_bucket) link;
  +    /** The type of bucket.  These types can be found in the enumerated
  +     *  type above */
  +    ap_bucket_type *type;
  +    /** The length of the data in the bucket.  This could have been implemented
  +     *  with a function, but this is an optimization, because the most
  +     *  common thing to do will be to get the length.  If the length is unknown,
  +     *  the value of this field will be -1.
  +     */
  +    apr_off_t length;
  +    /** type-dependent data hangs off this pointer */
  +    void *data;	
  +};
  +
   /** A list of buckets */
   struct ap_bucket_brigade {
       /** The pool to associate the brigade with.  The data is not allocated out
  @@ -241,6 +250,15 @@
   
   #define AP_BUCKET_REMOVE(e)	AP_RING_REMOVE((e), link)
   
  +#define AP_BUCKET_IS_EOS(e)         (e->type == &ap_eos_type)
  +#define AP_BUCKET_IS_FILE(e)        (e->type == &ap_file_type)
  +#define AP_BUCKET_IS_PIPE(e)        (e->type == &ap_pipe_type)
  +#define AP_BUCKET_IS_SOCKET(e)      (e->type == &ap_socket_type)
  +#define AP_BUCKET_IS_HEAP(e)        (e->type == &ap_heap_type)
  +#define AP_BUCKET_IS_TRANSIENT(e)   (e->type == &ap_transient_type)
  +#define AP_BUCKET_IS_IMMORTAL(e)    (e->type == &ap_immortal_type)
  +#define AP_BUCKET_IS_mmap(e)        (e->type == &ap_mmap_type)
  +
   /**
    * General-purpose reference counting for the varous bucket types.
    *
  @@ -492,16 +510,23 @@
   void ap_bucket_pipe_register(apr_pool_t *p);
   void ap_bucket_eos_register(apr_pool_t *p);
   
  -int ap_file_type(void);
  -int ap_heap_type(void);
  -int ap_transient_type(void);
  -int ap_mmap_type(void);
  -int ap_immortal_type(void);
  -int ap_socket_type(void);
  -int ap_pipe_type(void);
  -int ap_eos_type(void);
  -
  +API_EXPORT(apr_status_t) ap_bucket_setaside_notimpl(ap_bucket *data);
  +API_EXPORT(apr_status_t) ap_bucket_split_notimpl(ap_bucket *data, 
  +                                                 apr_off_t point);
  +API_EXPORT(void) ap_bucket_destroy_notimpl(void *data);
  +/* There is no ap_bucket_read_notimpl, because it is a required function
  + */
   int ap_insert_bucket_type(ap_bucket_type *type);
  +
  +/* All of the bucket types implemented by the core */
  +extern ap_bucket_type ap_eos_type;
  +extern ap_bucket_type ap_file_type;
  +extern ap_bucket_type ap_heap_type;
  +extern ap_bucket_type ap_mmap_type;
  +extern ap_bucket_type ap_pipe_type;
  +extern ap_bucket_type ap_immortal_type;
  +extern ap_bucket_type ap_transient_type;
  +extern ap_bucket_type ap_socket_type;
   
   /*  *****  Shared reference-counted buckets  *****  */
   
  
  
  
  1.169     +6 -6      apache-2.0/src/main/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_core.c,v
  retrieving revision 1.168
  retrieving revision 1.169
  diff -u -r1.168 -r1.169
  --- http_core.c	2000/10/13 17:36:51	1.168
  +++ http_core.c	2000/10/15 18:15:11	1.169
  @@ -3117,8 +3117,8 @@
               ap_bucket_destroy(destroy_me);
               destroy_me = NULL;
           }
  -        if ((e->type == ap_eos_type())  || (e->type == ap_file_type()) ||
  -            (e->type == ap_pipe_type())) {
  +        if (AP_BUCKET_IS_EOS(e)  || AP_BUCKET_IS_FILE(e) ||
  +            AP_BUCKET_IS_PIPE(e)) {
               pass_the_brigade = 1;
           }
           else {
  @@ -3226,7 +3226,7 @@
           char chunk_hdr[20]; /* enough space for the snprintf below */
   
   	AP_BRIGADE_FOREACH(e, b) {
  -	    if (e->type == ap_eos_type()) {
  +	    if (AP_BUCKET_IS_EOS(e)) {
   		/* there shouldn't be anything after the eos */
   		eos = e;
   		break;
  @@ -3400,10 +3400,10 @@
           nbytes = 0; /* in case more points to another brigade */
           more = NULL;
           AP_BRIGADE_FOREACH(e, b) {
  -            if (e->type == ap_eos_type()) {
  +            if (AP_BUCKET_IS_EOS(e)) {
                   break;
               }
  -            else if (e->type == ap_file_type()) {
  +            else if (AP_BUCKET_IS_FILE(e)) {
                   ap_bucket_file *a = e->data;
                   /* Assume there is at most one AP_BUCKET_FILE in the brigade */
                   fd = a->fd;
  @@ -3442,7 +3442,7 @@
           /* Completed iterating over the brigades, now determine if we want to
            * buffer the brigade or send the brigade out on the network
            */
  -        if (!fd && (!more) && (nbytes < MIN_SIZE_TO_WRITE) &&
(e->type != ap_eos_type())) {
  +        if (!fd && (!more) && (nbytes < MIN_SIZE_TO_WRITE) &&
!AP_BUCKET_IS_EOS(e)) {
               ap_save_brigade(f, &ctx->b, &b);
               return APR_SUCCESS;
           }
  
  
  
  1.173     +2 -2      apache-2.0/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v
  retrieving revision 1.172
  retrieving revision 1.173
  diff -u -r1.172 -r1.173
  --- http_protocol.c	2000/10/14 06:53:02	1.172
  +++ http_protocol.c	2000/10/15 18:15:11	1.173
  @@ -890,7 +890,7 @@
       }
   
       e = AP_BRIGADE_FIRST(b);
  -    if (f->c->remain == 0 && e->type == ap_eos_type()) {
  +    if (f->c->remain == 0 && AP_BUCKET_IS_EOS(e)) {
           bb = ap_brigade_split(b, AP_BUCKET_NEXT(e));
           ctx->b = bb;
           return APR_SUCCESS;
  @@ -2441,7 +2441,7 @@
                                    timeout);
               }
               b = AP_BRIGADE_FIRST(bb);
  -            if (b->type == ap_eos_type()) {
  +            if (AP_BUCKET_IS_EOS(b)) {
                   r->connection->remain = 0;
                   break;
               }
  
  
  
  1.31      +2 -1      apache-2.0/src/main/util_filter.c
  
  Index: util_filter.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/util_filter.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- util_filter.c	2000/10/13 05:35:56	1.30
  +++ util_filter.c	2000/10/15 18:15:11	1.31
  @@ -212,7 +212,8 @@
   API_EXPORT(apr_status_t) ap_pass_brigade(ap_filter_t *next, ap_bucket_brigade *bb)
   {
       if (next) {
  -        if (AP_BRIGADE_LAST(bb)->type == ap_eos_type() && next->r) {
  +        ap_bucket *e;
  +        if ((e = AP_BRIGADE_LAST(bb)) && AP_BUCKET_IS_EOS(e) && next->r)
{
               next->r->eos_sent = 1;
           }
           return next->frec->filter_func.out_func(next, bb);
  
  
  
  1.25      +1 -1      apache-2.0/src/modules/experimental/mod_charset_lite.c
  
  Index: mod_charset_lite.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/experimental/mod_charset_lite.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- mod_charset_lite.c	2000/10/13 05:35:57	1.24
  +++ mod_charset_lite.c	2000/10/15 18:15:12	1.25
  @@ -674,7 +674,7 @@
                   done = 1;
                   break;
               }
  -            if (dptr->type == AP_BUCKET_EOS) {
  +            if (AP_BUCKET_IS_EOS(dptr)) {
                   done = 1;
                   cur_len = AP_END_OF_BRIGADE; /* XXX yuck, but that tells us to send
                                    * eos down; when we minimize our bb construction
  
  
  
  1.67      +1 -1      apache-2.0/src/modules/standard/mod_include.c
  
  Index: mod_include.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_include.c,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- mod_include.c	2000/10/13 05:35:57	1.66
  +++ mod_include.c	2000/10/15 18:15:13	1.67
  @@ -190,7 +190,7 @@
       int state = 0;
   
       do {
  -        if (dptr->type == ap_eos_type()) {
  +        if (AP_BUCKET_IS_EOS(dptr)) {
               break;
           }
           ap_bucket_read(dptr, &buf, &len, 0);
  
  
  

Mime
View raw message