[Pixman] [RFC PATCH 1/3] utils.[ch]: add FENCE_MALLOC_ACTIVE
Pekka Paalanen
ppaalanen at gmail.com
Fri May 15 01:18:12 PDT 2015
On Thu, 14 May 2015 00:22:03 +0100
"Ben Avison" <bavison at riscosopen.org> wrote:
> 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.
That's a good idea! I'll do that.
Thanks,
pq
More information about the Pixman
mailing list