Re: [RFA] Ensure result of make_cleanup is never NULL.

Pedro Alves
2012-04-16T10:52:39Z

This looks good to me.

On 04/16/2012 03:06 AM, Doug Evans wrote:
> +/* A fencepost used to mark the end of a cleanup chain.
> + The value is chosen to be non-NULL so that make_cleanup never returns NULL,
> + and cause a segv if dereferenced. */
> +#define CLEANUP_FENCEPOST ((struct cleanup *) 1)

I'd mildly prefer -1. Easier to spot as being special with the
debugger; as a general principle for these things, it's an address less likely
to end be created by mistake (thinking of &foo->a yieling a pointer to a
low address when foo is NULL); and it is just more customary.

--
Pedro Alves