From cvs-return-727-apmail-apr-cvs-archive=apr.apache.org@apr.apache.org Mon Feb 19 01:42:59 2001 Return-Path: Delivered-To: apmail-apr-cvs-archive@apr.apache.org Received: (qmail 65625 invoked by uid 500); 19 Feb 2001 01:42:58 -0000 Mailing-List: contact cvs-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: dev@apr.apache.org Delivered-To: mailing list cvs@apr.apache.org Received: (qmail 65614 invoked by uid 500); 19 Feb 2001 01:42:57 -0000 Delivered-To: apmail-apr-util-cvs@apache.org Date: 19 Feb 2001 01:42:57 -0000 Message-ID: <20010219014257.65610.qmail@apache.org> From: jwoolley@apache.org To: apr-util-cvs@apache.org Subject: cvs commit: apr-util/include apr_buckets.h jwoolley 01/02/18 17:42:57 Modified: include apr_buckets.h Log: Add apr_bucket_delete(), which is a wrapper macro around bucket removal/ destruction. Useful for decreasing code verbosity. Revision Changes Path 1.80 +23 -6 apr-util/include/apr_buckets.h Index: apr_buckets.h =================================================================== RCS file: /home/cvs/apr-util/include/apr_buckets.h,v retrieving revision 1.79 retrieving revision 1.80 diff -u -d -u -r1.79 -r1.80 --- apr_buckets.h 2001/02/18 00:13:24 1.79 +++ apr_buckets.h 2001/02/19 01:42:56 1.80 @@ -757,16 +757,33 @@ APU_DECLARE(void) apr_bucket_init_types(apr_pool_t *p); /** - * free the resources used by a bucket. If multiple buckets refer to + * Free the resources used by a bucket. If multiple buckets refer to * the same resource it is freed when the last one goes away. + * @see apr_bucket_delete() * @param e The bucket to destroy * @deffunc void apr_bucket_destroy(apr_bucket *e) */ -#define apr_bucket_destroy(e) \ - { \ - e->type->destroy(e->data); \ - free(e); \ - } +#define apr_bucket_destroy(e) do { \ + e->type->destroy(e->data); \ + free(e); \ + } while (0) + +/** + * Delete a bucket by removing it from its brigade (if any) and then + * destroying it. + * @tip This mainly acts as an aid in avoiding code verbosity. It is + * the preferred exact equivalent to: + *
  + *      APR_BUCKET_REMOVE(e);
  + *      apr_bucket_destroy(e);
  + * 
+ * @param e The bucket to delete + * @deffunc void apr_bucket_delete(apr_bucket *e) + */ +#define apr_bucket_delete(e) do { \ + APR_BUCKET_REMOVE(e); \ + apr_bucket_destroy(e); \ + } while (0) /** * read the data from the bucket