[Pixman] [RFC PATCH 1/3] utils.[ch]: add FENCE_MALLOC_ACTIVE

Ben Avison bavison at riscosopen.org
Wed May 13 16:22:03 PDT 2015


On Fri, 08 May 2015 13:45:35 +0100, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> diff --git a/test/utils.h b/test/utils.h
> index fc10524..6b88bf2 100644
> --- a/test/utils.h
> +++ b/test/utils.h
> @@ -86,6 +86,15 @@ is_little_endian (void)
>  void
>  image_endian_swap (pixman_image_t *img);
> +#if defined (HAVE_MPROTECT) && defined (HAVE_GETPAGESIZE) && \
> +    defined (HAVE_SYS_MMAN_H) && defined (HAVE_MMAP)
> +/* fence_malloc and friends have working fence implementation.
> + * Without this, fence_malloc still allocs but does not catch
> + * out-of-bounds accesses.
> + */
> +#define FENCE_MALLOC_ACTIVE
> +#endif

My only comment would be that perhaps this should be
#if defined (HAVE...
#define FENCE_MALLOC_ACTIVE 1
#else
#define FENCE_MALLOC_ACTIVE 0
#endif

and replace #ifdefs elsewhere with #ifs, so that if anyone uses
FENCE_MALLOC_ACTIVE having forgotten to include utils.h then the
compiler will pick up their error.

Ben


More information about the Pixman mailing list