httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwool...@apache.org
Subject cvs commit: httpd-2.0/server error_bucket.c
Date Sat, 25 Aug 2001 22:56:22 GMT
jwoolley    01/08/25 15:56:22

  Modified:    include  http_protocol.h
               server   error_bucket.c
  Log:
  BUCKETS SMS PHASE 1
  
  Update to match apr-util
  
  Revision  Changes    Path
  1.63      +2 -0      httpd-2.0/include/http_protocol.h
  
  Index: http_protocol.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/http_protocol.h,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -d -u -r1.62 -r1.63
  --- http_protocol.h	2001/08/11 04:04:11	1.62
  +++ http_protocol.h	2001/08/25 22:56:22	1.63
  @@ -597,6 +597,8 @@
       int status;
       /** The error string */
       const char    *data;
  +    /** The SMS from which this structure was allocated */
  +    apr_sms_t *sms;
   };
   
   AP_DECLARE_DATA extern const apr_bucket_type_t ap_bucket_type_error;
  
  
  
  1.7       +17 -8     httpd-2.0/server/error_bucket.c
  
  Index: error_bucket.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/error_bucket.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -d -u -r1.6 -r1.7
  --- error_bucket.c	2001/08/08 06:04:07	1.6
  +++ error_bucket.c	2001/08/25 22:56:22	1.7
  @@ -68,17 +68,20 @@
       return APR_SUCCESS;
   }
   
  +static void error_destroy(void *data) {
  +    ap_bucket_error *h;
  +    apr_sms_free(h->sms, h);
  +}
  +
   AP_DECLARE(apr_bucket *) ap_bucket_error_make(apr_bucket *b, int error, 
   		const char *buf, apr_pool_t *p)
   {
       ap_bucket_error *h;
   
  -    h = malloc(sizeof(*h));
  -    if (h == NULL) {
  -        return NULL;
  -    }
  +    h = (ap_bucket_error *)apr_sms_malloc(b->sms, sizeof(*h));
       h->status = error;
       h->data = (buf) ? apr_pstrdup(p, buf) : NULL;
  +    h->sms = b->sms;
   
       b->length = 0;
       b->start  = 0;
  @@ -90,16 +93,22 @@
   AP_DECLARE(apr_bucket *) ap_bucket_error_create(int error, 
   		const char *buf, apr_pool_t *p)
   {
  -    apr_bucket *b = (apr_bucket *)malloc(sizeof(*b));
  -
  +    apr_sms_t *sms;
  +    apr_bucket *b;
  +    
  +    if (!apr_bucket_global_sms) {
  +        apr_sms_std_create(&apr_bucket_global_sms);
  +    }
  +    sms = apr_bucket_global_sms;
  +    b = (apr_bucket *)apr_sms_malloc(sms, sizeof(*b));
       APR_BUCKET_INIT(b);
  -    b->free = free;
  +    b->sms = sms;
       return ap_bucket_error_make(b, error, buf, p);
   }
   
   AP_DECLARE_DATA const apr_bucket_type_t ap_bucket_type_error = {
       "ERROR", 5,
  -    free,
  +    error_destroy,
       error_read,
       apr_bucket_setaside_notimpl,
       apr_bucket_split_notimpl,
  
  
  

Mime
View raw message