[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnulib] Patch proposal: 1-gary-safe-xfree.patch
From: |
Paul Eggert |
Subject: |
Re: [Bug-gnulib] Patch proposal: 1-gary-safe-xfree.patch |
Date: |
11 Sep 2003 00:59:42 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
"Gary V. Vaughan" <address@hidden> writes:
> This patch does change the semantics of XFREE slightly, but in a
> beneficial way.
The part about evaluating the argument once is nice, but why do you
want XFREE to return NULL? I find this:
XFREE (p);
p = NULL;
to be much clearer than this:
p = XFREE (p);
Traditionally 'free' returns 'void', and it's confusing to have
XFREE return something else.
How about the following implementation instead? It evaluates
Var only once.
# define XFREE(Var) \
do \
{ \
void *to_be_freed = (Var); \
if (to_be_freed) \
free (to_be_freed); \
} \
while (0)
- [Bug-gnulib] Patch proposal: 1-gary-safe-xfree.patch, Gary V. Vaughan, 2003/09/10
- Re: [Bug-gnulib] Patch proposal: 1-gary-safe-xfree.patch, Bruno Haible, 2003/09/10
- Re: [Bug-gnulib] Patch proposal: 1-gary-safe-xfree.patch,
Paul Eggert <=
- Re: [Bug-gnulib] Patch proposal: 1-gary-safe-xfree.patch, Paul Eggert, 2003/09/11
- Re: [Bug-gnulib] Patch proposal: 1-gary-safe-xfree.patch, Gary V. Vaughan, 2003/09/11
- Re: [Bug-gnulib] Patch proposal: 1-gary-safe-xfree.patch, Paul Eggert, 2003/09/12
- Re: [Bug-gnulib] Patch proposal: 1-gary-safe-xfree.patch, Jim Meyering, 2003/09/13
- Re: [Bug-gnulib] Patch proposal: 1-gary-safe-xfree.patch, Gary V. Vaughan, 2003/09/15
- Re: [Bug-gnulib] Patch proposal: 1-gary-safe-xfree.patch, Paul Eggert, 2003/09/15
- Re: [Bug-gnulib] Patch proposal: 1-gary-safe-xfree.patch, Gary V . Vaughan, 2003/09/16
- [Bug-gnulib] Re: Patch proposal: 1-gary-safe-xfree.patch, Simon Josefsson, 2003/09/16