Re: compat/unsafe.h

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Sat, 21 Aug 2010 20:07:30 +1200

Henrik Nordström wrote:
> Stumbled over compat/unsafe.h again when trying to compile trunk after
> the purge merge.
>
> Imho these rules in compat/unsafe.h should be dropped, replaced by
> coding standards for the different sections and auditing.
>
> - The rules originally come from lazyness in Squid-2 where we did not
> want to check return code of malloc() or is data had been allocated
> before free().
> - The way they are implemented (#define) causes issues with perfectly
> valid code such as system headers..
> - these rules makes it harder to integrate other code.
>
> Regards
> Henrik
>

IMO some of them such as the malloc/calloc/free which only force a
xfoo() version internal to Squid to be hard-coded should be done with a
real symbol swap-in in the relevant header files. That way the code can
go to using malloc/calloc/free and our custom wrappers plug-in silently
to src/ code where appropriate.

Others like sprintf which are still actually enforcing non-use of unsafe
functions should stay.

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.6
   Beta testers wanted for 3.2.0.1
Received on Sat Aug 21 2010 - 08:07:36 MDT

This archive was generated by hypermail 2.2.0 : Sun Aug 22 2010 - 12:00:05 MDT