httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@locus.apache.org
Subject cvs commit: apache-2.0/src/include ap_buckets.h
Date Tue, 15 Aug 2000 01:24:00 GMT
fanf        00/08/14 18:23:59

  Modified:    src/ap   ap_buckets_heap.c ap_buckets_transient.c
               src/include ap_buckets.h
  Log:
  the data in buckets is always character data, so change void * to char *
  accordingly and get rid of all the casts in the pointer arithmetic.
  
  Revision  Changes    Path
  1.6       +8 -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.5
  retrieving revision 1.6
  diff -u -u -r1.5 -r1.6
  --- ap_buckets_heap.c	2000/08/14 20:55:45	1.5
  +++ ap_buckets_heap.c	2000/08/15 01:23:58	1.6
  @@ -91,8 +91,8 @@
       b->alloc_addr = a->alloc_addr;
       b->alloc_len = a->alloc_len;
       b->end = a->end;
  -    a->end = (char *) a->start + nbyte;
  -    b->start = (char *) a->end + 1;
  +    a->end = a->start + nbyte;
  +    b->start = a->end + 1;
       newbuck->length = e->length - nbyte;
       e->length = nbyte;
   
  @@ -110,7 +110,7 @@
    * It is worth noting that if an error occurs, the buffer is in an unknown
    * state.
    */
  -static apr_status_t heap_insert(ap_bucket *e, const void *buf,
  +static apr_status_t heap_insert(ap_bucket *e, const char *buf,
                                   apr_size_t nbyte, apr_ssize_t *w)
   {
       int amt;
  @@ -128,7 +128,7 @@
    * leaving that for a later pass.  The basics are presented below, but this
    * is horribly broken.
    */
  -    amt = b->alloc_len - ((char *)b->end - (char *)b->start);
  +    amt = b->alloc_len - (b->end - b->start);
       total = 0;
       if (nbyte > amt) {
           /* loop through and write to the disk */
  @@ -136,7 +136,7 @@
       }
       /* now we know that nbyte < b->alloc_len */
       memcpy(b->end, buf, nbyte);
  -    b->end = (char *)b->end + nbyte;
  +    b->end = b->end + nbyte;
       *w = total + nbyte;
       return APR_SUCCESS;
   }
  @@ -150,7 +150,7 @@
       b->alloc_len  = DEFAULT_RWBUF_SIZE;
       memcpy(b->alloc_addr, a->start, e->length);
       b->start      = b->alloc_addr;
  -    b->end        = (char *) b->start + e->length;
  +    b->end        = b->start + e->length;
   
       e->type       = AP_BUCKET_HEAP;
       e->read       = heap_get_str;
  @@ -159,7 +159,7 @@
       e->destroy    = heap_destroy;
   }
   
  -API_EXPORT(ap_bucket *) ap_bucket_heap_create(const void *buf,
  +API_EXPORT(ap_bucket *) ap_bucket_heap_create(const char *buf,
                                   apr_size_t nbyte, apr_ssize_t *w)
   {
       ap_bucket *newbuf;
  @@ -175,7 +175,7 @@
   
       newbuf->data       = b;
       heap_insert(newbuf, buf, nbyte, w); 
  -    newbuf->length     = (char *) b->end - (char *) b->start;
  +    newbuf->length     = b->end - b->start;
   
       newbuf->type       = AP_BUCKET_HEAP;
       newbuf->read       = heap_get_str;
  
  
  
  1.6       +6 -6      apache-2.0/src/ap/ap_buckets_transient.c
  
  Index: ap_buckets_transient.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_buckets_transient.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -u -r1.5 -r1.6
  --- ap_buckets_transient.c	2000/08/14 20:55:45	1.5
  +++ ap_buckets_transient.c	2000/08/15 01:23:58	1.6
  @@ -83,8 +83,8 @@
       b = (ap_bucket_transient *)newbuck->data;
   
       b->end = a->end;
  -    a->end = (char*) a->start + nbyte;
  -    b->start = (char *) a->end + 1; 
  +    a->end = a->start + nbyte;
  +    b->start = a->end + 1; 
   
       newbuck->length = e->length - nbyte;
       e->length = nbyte;
  @@ -104,7 +104,7 @@
    * It is worth noting that if an error occurs, the buffer is in an unknown
    * state.
    */
  -static apr_status_t transient_insert(ap_bucket *e, const void *buf,
  +static apr_status_t transient_insert(ap_bucket *e, const char *buf,
                                  apr_size_t nbyte, apr_ssize_t *w)
   {
       ap_bucket_transient *b = (ap_bucket_transient *)e->data;
  @@ -118,12 +118,12 @@
        * much memory, but that can wait for the second pass.
        */
       b->start = buf;
  -    b->end = (char *)b->start + nbyte;
  +    b->end = b->start + nbyte;
       *w = nbyte;
       return APR_SUCCESS;
   }
   
  -API_EXPORT(ap_bucket *) ap_bucket_transient_create(const void *buf,
  +API_EXPORT(ap_bucket *) ap_bucket_transient_create(const char *buf,
                                  apr_size_t nbyte, apr_ssize_t *w)
   {
       ap_bucket *newbuf;
  @@ -136,7 +136,7 @@
   
       newbuf->data          = b;
       transient_insert(newbuf, buf, nbyte, w);
  -    newbuf->length        = (char *) b->end - (char *) b->start;
  +    newbuf->length        = b->end - b->start;
   
       newbuf->type          = AP_BUCKET_TRANSIENT;
       newbuf->read          = transient_get_str;
  
  
  
  1.8       +11 -11    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.7
  retrieving revision 1.8
  diff -u -u -r1.7 -r1.8
  --- ap_buckets.h	2000/08/15 01:14:29	1.7
  +++ ap_buckets.h	2000/08/15 01:23:59	1.8
  @@ -222,9 +222,9 @@
    */
   struct ap_bucket_transient {
       /** The start of the data in the bucket */
  -    const void    *start;
  +    const char    *start;
       /** The end of the data in the bucket */
  -    const void    *end;
  +    const char    *end;
   };
   
   typedef struct ap_bucket_heap ap_bucket_heap;
  @@ -236,13 +236,13 @@
       /** The start of the data actually allocated.  This should never be
        * modified, it is only used to free the bucket.
        */
  -    void    *alloc_addr;
  +    char    *alloc_addr;
       /** how much memory was allocated.  This may not be necessary */
       size_t  alloc_len;
       /** Where does the data the bucket is actually referencing start */
  -    void    *start;
  +    char    *start;
       /** Where does the data the bucket cares about end */               
  -    void    *end;
  +    char    *end;
   };
   
   typedef struct ap_bucket_mmap ap_bucket_mmap;
  @@ -262,9 +262,9 @@
   /** A bucket representing an mmap object */
   struct ap_bucket_mmap {
       /** Where does this buckets section of the mmap start */
  -    void      *start;
  +    char      *start;
       /** Where does this buckets section of the mmap end */
  -    void      *end;
  +    char      *end;
       /** The mmap sub_bucket referenced by this bucket */
       ap_mmap_sub_bucket *sub;  /* The mmap and ref count */    
   };
  @@ -396,9 +396,9 @@
    * @param nbyte The size of the buffer to insert.
    * @param w The number of bytes actually inserted into the bucket
    * @return The new bucket
  - * @deffunc ap_bucket *ap_bucket_heap_create(const void *buf, apr_size_t nbyte, apr_ssize_t
*w)
  + * @deffunc ap_bucket *ap_bucket_heap_create(const char *buf, apr_size_t nbyte, apr_ssize_t
*w)
    */
  -API_EXPORT(ap_bucket *) ap_bucket_heap_create(const void *buf,
  +API_EXPORT(ap_bucket *) ap_bucket_heap_create(const char *buf,
                                   apr_size_t nbyte, apr_ssize_t *w);
   
   
  @@ -419,9 +419,9 @@
    * @param nbyte The size of the data to insert.
    * @param w The number of bytes actually inserted into the bucket
    * @return The new bucket
  - * @deffunc ap_bucket *ap_bucket_transient_create(const void *buf, apr_size_t nbyte, apr_ssize_t
*w)
  + * @deffunc ap_bucket *ap_bucket_transient_create(const char *buf, apr_size_t nbyte, apr_ssize_t
*w)
    */
  -API_EXPORT(ap_bucket *) ap_bucket_transient_create(const void *buf,
  +API_EXPORT(ap_bucket *) ap_bucket_transient_create(const char *buf,
                                  apr_size_t nbyte, apr_ssize_t *w);
   
   /**
  
  
  

Mime
View raw message