Re: [pcre-dev] [PATCH] add malloc and alloc_size attributes to allocation functions

2012-06-04 Thread Craig Silverstein
I'll volunteer to take on this review, since I have some experience with __attribute__(malloc) due to my work on gperftools. First, while I disagree that the cost to the header file is basically 0 -- I think it definitely has a negative impact on readability, at least to some extent -- I support

Re: [pcre-dev] [PATCH] add malloc and alloc_size attributes to allocation functions

2012-06-04 Thread Nuno Lopes
Hi, The code itself looks good, with a few comments: } +#if defined(__GNUC__) __GNUC__ = 3 } +# define PCRE_ATTR_MALLOC __attribute__((__malloc__)) I prefer to check for __attribute__ support in autoconf, and condition on #ifdef HAVE___ATTRIBUTE__ rather than checking for a particular

[pcre-dev] [PATCH] add malloc and alloc_size attributes to allocation functions

2012-06-02 Thread Nuno Lopes
Hi, Please find in attach a patch to add the malloc and alloc_size attributes to PCRE's custom allocation functions. The malloc attribute specifies that a given function behaves like malloc, and therefore the returned pointer is fresh (i.e., doesn't alias anything else). It is used mostly

Re: [pcre-dev] [PATCH] add malloc and alloc_size attributes to allocation functions

2012-06-02 Thread Zoltán Herczeg
Hi, I feel this patch just adds unnecessary complexity to the header file. What exactly are these optimizations? For buffer overflows, valgrind is the perfect detection tool with its red zone based detection algorithm. What else can you do with these macros? Or better to ask: what is your

Re: [pcre-dev] [PATCH] add malloc and alloc_size attributes to allocation functions

2012-06-02 Thread Philip Hazel
On Sat, 2 Jun 2012, Zoltán Herczeg wrote: I feel this patch just adds unnecessary complexity to the header file. What exactly are these optimizations? For buffer overflows, valgrind is the perfect detection tool with its red zone based detection algorithm. What else can you do with these