svn commit: r184205 - in head: . share/man/man9 sys/arm/arm sys/cam/scsi sys/compat/linux sys/contrib/altq/altq sys/contrib/ipfilter/netinet sys/dev/ar sys/dev/ce sys/dev/hwpmc sys/dev/lmc sys/dev/...

Dag-Erling Smørgrav des at des.no
Thu Oct 23 16:44:38 UTC 2008


Dag-Erling Smorgrav <des at FreeBSD.org> writes:
> Retire the MALLOC and FREE macros.  They are an abomination unto style(9).

The following one-liner can be used to convert existing code:

find . -type f -name \*.c | xargs perl -p -i -e '
  s/\bMALLOC(\s*\()([^,]+?),\s*([^,]+?),\s*/$2 = malloc$1/;
  s/\bFREE(\s*\()/free$1/;
'

Or if you absolutely positively want the useless cast:

find . -type f -name \*.c | xargs perl -p -i -e '
  s/\bMALLOC(\s*\()([^,]+?),\s*([^,]+?),\s*/$2 = ($3)malloc$1/;
  s/\bFREE(\s*\()/free$1/;
'

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the svn-src-head mailing list