apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: cvs commit: apr-util/include apr_buckets.h
Date Wed, 28 Feb 2001 22:24:48 GMT
On Wed, Feb 28, 2001 at 05:52:49PM -0000, jwoolley@apache.org wrote:
> jwoolley    01/02/28 09:52:48
> 
>   Modified:    .        CHANGES
>                buckets  apr_buckets_file.c apr_buckets_heap.c
>                         apr_buckets_mmap.c apr_buckets_pool.c
>                         apr_buckets_refcount.c
>                include  apr_buckets.h
>   Log:
>   apr_bucket_shared_destroy() now returns a boolean value
>   instead of a pointer, since the caller already knew the
>   pointer value anyway. (Issue #8 from the "Bucket API
>   cleanup issues" thread.)
>...
>   --- apr_buckets_file.c	2001/02/28 17:18:59	1.37
>   +++ apr_buckets_file.c	2001/02/28 17:52:42	1.38
>   @@ -86,13 +86,11 @@
>    
>    static void file_destroy(void *data)
>    {
>   -    apr_bucket_file *f;
>   +    apr_bucket_file *f = data;
>    
>   -    f = apr_bucket_shared_destroy(data);
>   -    if (f == NULL) {
>   -        return;
>   +    if (apr_bucket_shared_destroy(data)) {
>   +        free(f);
>        }
>   -    free(f);
>    }

The use of the "f" local variable is pointless in the above code. "data" is
valid throughout the function. The aliasing of "data" to "f" simply makes
the connection between destroy() and free() less obvious.

In all of these destroy() functions, the local should simply be tossed, and
"data" used directly.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Mime
View raw message