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/main util_filter.c
Date Tue, 03 Oct 2000 00:44:01 GMT
rbb         00/10/02 17:44:00

  Modified:    src/include util_filter.h
               src/main util_filter.c
  Log:
  Replace ap_get_data_from_filter and ap_save_data_to_filter with
  ap_save_brigade.  This function does not try to save the actual brigade to
  a specific location.  If just traverses the brigade, calls setaside if
  it is available and concatenates it with a previously setaside brigade.
  
  The resulting brigade is returned to the caller for them to save it to
  the appropriate location.
  
  Revision  Changes    Path
  1.20      +9 -18     apache-2.0/src/include/util_filter.h
  
  Index: util_filter.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/util_filter.h,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- util_filter.h	2000/10/02 00:47:26	1.19
  +++ util_filter.h	2000/10/03 00:44:00	1.20
  @@ -346,28 +346,19 @@
    * you retrieve data, if you pass in a bucket brigade to the get function,
    * it will append the current brigade onto the one that you are retrieving.
    */
  -/**
  - * Get data that was saved aside for the current filter from an earlier call
  - * @param f The current filter
  - * @param b The bucket brigade to append to the data that was saved earlier.
  - *          This should be the brigade that was most recently passed to the
  - *          filter
  - * @return A single bucket brigade containing all of the data that was set 
  - *         aside from a previous call to ap_save_data_to_filter and the data
  - *         that was most recently passed to this filter.
  - * @deffunc ap_bucket_brigade *ap_get_saved_data(ap_filter_t *f, ap_bucket_brigade **b)
  - */
  -API_EXPORT(ap_bucket_brigade *) ap_get_saved_data(ap_filter_t *f, 
  -                                                  ap_bucket_brigade **b);
   
   /**
  - * Save a bucket brigade to a filter.  This is used to save portions of the
  - * data off to the side for consumption later
  + * prepare a bucket brigade to be setaside.  If a different brigade was 
  + * set-aside earlier, then the two brigades are concatenated together.
    * @param f The current filter
  - * @param b The bucket brigade to save aside
  - * @deffunc void ap_save_data_to_filter(ap_filter_t *f, ap_bucket_brigade **b)
  + * @param save_to The brigade that was previously set-aside.  Regardless, the
  + *             new bucket brigade is returned in this location.
  + * @param b The bucket brigade to save aside.  This brigade is always empty
  + *          on return
  + * @deffunc void ap_save_brigade(ap_filter_t *f, ap_bucket_brigade **save_to, ap_bucket_brigade
**b)
    */
  -API_EXPORT(void) ap_save_data_to_filter(ap_filter_t *f, ap_bucket_brigade **b);    
  +API_EXPORT(void) ap_save_brigade(ap_filter_t *f, ap_bucket_brigade **save_to,
  +                                        ap_bucket_brigade **b);    
   
   #ifdef __cplusplus
   }
  
  
  
  1.24      +5 -32     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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- util_filter.c	2000/10/02 22:00:59	1.23
  +++ util_filter.c	2000/10/03 00:44:00	1.24
  @@ -209,48 +209,21 @@
       return AP_NOBODY_WROTE;
   }
   
  -API_EXPORT(ap_bucket_brigade *) ap_get_saved_data(ap_filter_t *f, 
  -                                                  ap_bucket_brigade **b)
  +API_EXPORT(void) ap_save_brigade(ap_filter_t *f, ap_bucket_brigade **saveto,
  +                                        ap_bucket_brigade **b)
   {
  -    ap_bucket_brigade *bb = (ap_bucket_brigade *)f->ctx;
  -
  -    /* If we have never stored any data in the filter, then we had better
  -     * create an empty bucket brigade so that we can concat.
  -     */
  -    if (!bb) {
  -        bb = ap_brigade_create(f->r->pool);
  -    }
  -
  -    /* join the two brigades together.  *b is now empty so we can 
  -     * safely destroy it. 
  -     */
  -    AP_BRIGADE_CONCAT(bb, *b);
  -    ap_brigade_destroy(*b);
  -    /* clear out the filter's context pointer.  If we don't do this, then
  -     * when we save more data to the filter, we will be appended to what is
  -     * currently there.  This will mean repeating data.... BAD!  :-)
  -     */
  -    f->ctx = NULL;
  -    
  -    return bb;
  -}
  -
  -API_EXPORT(void) ap_save_data_to_filter(ap_filter_t *f, ap_bucket_brigade **b)
  -{
  -    ap_bucket_brigade *bb = (ap_bucket_brigade *)f->ctx;
       ap_bucket *e;
   
       /* If have never stored any data in the filter, then we had better
        * create an empty bucket brigade so that we can concat.
        */
  -    if (!bb) {
  -        bb = ap_brigade_create(f->r->pool);
  +    if (!(*saveto)) {
  +        *saveto = ap_brigade_create(f->r->pool);
       }
       
       AP_RING_FOREACH(e, &(*b)->list, ap_bucket, link) {
           if (e->setaside)
               e->setaside(e);
       }
  -    AP_BRIGADE_CONCAT(bb, *b);
  -    f->ctx = bb;
  +    AP_BRIGADE_CONCAT(*saveto, *b);
   }
  
  
  

Mime
View raw message