httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@locus.apache.org
Subject cvs commit: apache-2.0/src/include ap_buckets.h
Date Sun, 15 Oct 2000 22:24:20 GMT
gstein      00/10/15 15:24:20

  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
  Log:
  const-ify the type stuff and simplify the type  registration process
  
  Revision  Changes    Path
  1.23      +11 -10    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.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- ap_buckets.c	2000/10/15 18:15:08	1.22
  +++ ap_buckets.c	2000/10/15 22:24:12	1.23
  @@ -229,19 +229,20 @@
   void ap_init_bucket_types(apr_pool_t *p)
   {
       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);
  -    ap_bucket_mmap_register(p);
  -    ap_bucket_immortal_register(p);
  -    ap_bucket_socket_register(p);
  -    ap_bucket_pipe_register(p);
  -    ap_bucket_eos_register(p);
  +
  +    ap_insert_bucket_type(&ap_eos_type);
  +    ap_insert_bucket_type(&ap_file_type);
  +    ap_insert_bucket_type(&ap_heap_type);
  +    ap_insert_bucket_type(&ap_mmap_type);
  +    ap_insert_bucket_type(&ap_pipe_type);
  +    ap_insert_bucket_type(&ap_immortal_type);
  +    ap_insert_bucket_type(&ap_transient_type);
  +    ap_insert_bucket_type(&ap_socket_type);
   }
   
  -int ap_insert_bucket_type(ap_bucket_type *type)
  +int ap_insert_bucket_type(const ap_bucket_type *type)
   {
  -    ap_bucket_type **newone = (ap_bucket_type **)apr_push_array(bucket_types);
  +    const ap_bucket_type **newone = (ap_bucket_type **)apr_push_array(bucket_types);
   
       newone = &type;
   
  
  
  
  1.9       +7 -8      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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ap_buckets_eos.c	2000/10/15 18:15:09	1.8
  +++ ap_buckets_eos.c	2000/10/15 22:24:12	1.9
  @@ -64,9 +64,6 @@
       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;
  @@ -81,9 +78,11 @@
   {
       ap_bucket_do_create(ap_bucket_make_eos(b));
   }
  -
  -void ap_bucket_eos_register(apr_pool_t *p)
  -{
  -    ap_insert_bucket_type(&ap_eos_type);
  -}
   
  +const ap_bucket_type ap_eos_type = {
  +    "EOS", 4,
  +    ap_bucket_destroy_notimpl,
  +    eos_read,
  +    ap_bucket_setaside_notimpl,
  +    ap_bucket_split_notimpl
  +};
  
  
  
  1.5       +9 -9      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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ap_buckets_file.c	2000/10/15 18:15:09	1.4
  +++ ap_buckets_file.c	2000/10/15 22:24:13	1.5
  @@ -108,9 +108,6 @@
       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)
   {
  @@ -131,13 +128,16 @@
       return b;
   }
   
  -API_EXPORT(ap_bucket *) ap_bucket_create_file(apr_file_t *fd, apr_off_t offset, apr_size_t
len)
  +API_EXPORT(ap_bucket *) ap_bucket_create_file(apr_file_t *fd,
  +                                              apr_off_t offset, apr_size_t len)
   {
       ap_bucket_do_create(ap_bucket_make_file(b, fd, offset, len));
   }
  -
  -void ap_bucket_file_register(apr_pool_t *p)
  -{
  -    ap_insert_bucket_type(&ap_file_type);
  -}
   
  +const ap_bucket_type ap_file_type = {
  +    "FILE", 4,
  +    ap_bucket_destroy_notimpl,
  +    file_read,
  +    ap_bucket_setaside_notimpl,
  +    ap_bucket_split_notimpl
  +};
  
  
  
  1.13      +7 -8      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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ap_buckets_heap.c	2000/10/15 18:15:09	1.12
  +++ ap_buckets_heap.c	2000/10/15 22:24:13	1.13
  @@ -88,9 +88,6 @@
       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)
   {
  @@ -143,9 +140,11 @@
   {
       ap_bucket_do_create(ap_bucket_make_heap(b, buf, length, copy, w));
   }
  -
  -void ap_bucket_heap_register(apr_pool_t *p)
  -{
  -    ap_insert_bucket_type(&ap_heap_type);
  -}
   
  +const ap_bucket_type ap_heap_type = {
  +    "HEAP", 4,
  +    heap_destroy,
  +    heap_read,
  +    ap_bucket_setaside_notimpl,
  +    ap_bucket_split_shared
  +};
  
  
  
  1.13      +7 -8      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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ap_buckets_mmap.c	2000/10/15 18:15:09	1.12
  +++ ap_buckets_mmap.c	2000/10/15 22:24:13	1.13
  @@ -84,9 +84,6 @@
       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?
    */
  @@ -118,9 +115,11 @@
   {
       ap_bucket_do_create(ap_bucket_make_mmap(b, mm, start, length));
   }
  -
  -void ap_bucket_mmap_register(apr_pool_t *p)
  -{
  -    ap_insert_bucket_type(&ap_mmap_type);
  -}
   
  +const ap_bucket_type ap_mmap_type = {
  +    "MMAP", 4,
  +    mmap_destroy,
  +    mmap_read,
  +    ap_bucket_setaside_notimpl,
  +    ap_bucket_split_shared
  +};
  
  
  
  1.14      +7 -8      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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ap_buckets_pipe.c	2000/10/15 18:15:09	1.13
  +++ ap_buckets_pipe.c	2000/10/15 22:24:13	1.14
  @@ -97,9 +97,6 @@
       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)
   {
       /*
  @@ -126,9 +123,11 @@
   {
       ap_bucket_do_create(ap_bucket_make_pipe(b, p));
   }
  -
  -void ap_bucket_pipe_register(apr_pool_t *p)
  -{
  -    ap_insert_bucket_type(&ap_pipe_type);
  -}
   
  +const ap_bucket_type ap_pipe_type = {
  +    "PIPE", 4,
  +    ap_bucket_destroy_notimpl,
  +    pipe_read,
  +    ap_bucket_setaside_notimpl,
  +    ap_bucket_split_notimpl
  +};
  
  
  
  1.9       +15 -16    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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ap_buckets_simple.c	2000/10/15 18:15:09	1.8
  +++ ap_buckets_simple.c	2000/10/15 22:24:13	1.9
  @@ -103,9 +103,6 @@
       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)
   {
  @@ -132,11 +129,6 @@
       ap_bucket_do_create(ap_bucket_make_immortal(b, buf, length));
   }
   
  -void ap_bucket_immortal_register(apr_pool_t *p)
  -{
  -    ap_insert_bucket_type(&ap_immortal_type);
  -}
  -
   /*
    * XXX: This function could do with some tweaking to reduce memory
    * usage in various cases, e.g. share buffers in the heap between all
  @@ -164,9 +156,6 @@
       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,9 +172,19 @@
   {
       ap_bucket_do_create(ap_bucket_make_transient(b, buf, length));
   }
  -
  -void ap_bucket_transient_register(apr_pool_t *p)
  -{
  -    ap_insert_bucket_type(&ap_transient_type);
  -}
   
  +const ap_bucket_type ap_immortal_type = {
  +    "IMMORTAL", 4,
  +    free,
  +    simple_read,
  +    ap_bucket_setaside_notimpl,
  +    simple_split
  +};
  +
  +const ap_bucket_type ap_transient_type = {
  +    "TRANSIENT", 4,
  +    ap_bucket_destroy_notimpl, 
  +    simple_read,
  +    transient_setaside,
  +    simple_split
  +};
  
  
  
  1.4       +7 -9      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ap_buckets_socket.c	2000/10/15 18:15:09	1.3
  +++ ap_buckets_socket.c	2000/10/15 22:24:14	1.4
  @@ -97,10 +97,6 @@
       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)
   {
       /*
  @@ -122,9 +118,11 @@
   {
       ap_bucket_do_create(ap_bucket_make_socket(b, p));
   }
  -
  -void ap_bucket_socket_register(apr_pool_t *p)
  -{
  -    ap_insert_bucket_type(&ap_socket_type);
  -}
   
  +const ap_bucket_type ap_socket_type = {
  +    "SOCKET", 4,
  +    ap_bucket_destroy_notimpl,
  +    socket_read,
  +    ap_bucket_setaside_notimpl, 
  +    ap_bucket_split_notimpl
  +};
  
  
  
  1.37      +14 -19    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.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- ap_buckets.h	2000/10/15 18:15:10	1.36
  +++ ap_buckets.h	2000/10/15 22:24:19	1.37
  @@ -136,7 +136,7 @@
       /**
        * The name of the bucket type
        */
  -    char *name;
  +    const char *name;
       /** 
        * The number of functions this bucket understands.  Can not be less than
        * four.
  @@ -191,7 +191,7 @@
       AP_RING_ENTRY(ap_bucket) link;
       /** The type of bucket.  These types can be found in the enumerated
        *  type above */
  -    ap_bucket_type *type;
  +    const 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,
  @@ -501,32 +501,27 @@
    */
   API_EXPORT(apr_status_t) ap_bucket_split(ap_bucket *e, apr_off_t point);
   
  -void ap_bucket_file_register(apr_pool_t *p);
  -void ap_bucket_heap_register(apr_pool_t *p);
  -void ap_bucket_transient_register(apr_pool_t *p);
  -void ap_bucket_mmap_register(apr_pool_t *p);
  -void ap_bucket_immortal_register(apr_pool_t *p);
  -void ap_bucket_socket_register(apr_pool_t *p);
  -void ap_bucket_pipe_register(apr_pool_t *p);
  -void ap_bucket_eos_register(apr_pool_t *p);
   
  +/* Bucket type handling */
  +
   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);
  +int ap_insert_bucket_type(const 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;
  +extern const ap_bucket_type ap_eos_type;
  +extern const ap_bucket_type ap_file_type;
  +extern const ap_bucket_type ap_heap_type;
  +extern const ap_bucket_type ap_mmap_type;
  +extern const ap_bucket_type ap_pipe_type;
  +extern const ap_bucket_type ap_immortal_type;
  +extern const ap_bucket_type ap_transient_type;
  +extern const ap_bucket_type ap_socket_type;
  +
   
   /*  *****  Shared reference-counted buckets  *****  */
   
  
  
  

Mime
View raw message