Ahoy.
I was digging around trying to fix a bunch of compiler-warnings, and
noticed that pretty much every invocation of my_free() resulted in
about a million warnings, such as this:
../xdata/xrddefault.c:190: warning: dereferencing type-punned
pointer will break strict-aliasing rules
Considering that not a single invocation of my_free() evaluates the
return code of the function, a macro such as
#define my_free(ptr) { if(ptr) { free(ptr); ptr = NULL; } }
would do the trick, and also provide a slight performance improvement.
Since a patch would be fairly huge, and I've kinda filled my quota
for huge patches for today, the following sed-script will take care
of the call-sites (requires sed 4.0.9 or later):
sed -i 's/my_free[^&]*&\([^)]*\).*/my_free(\1);/' */*.c
--
Andreas Ericsson [email protected]
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]