Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Oct 2008 18:44:36 +0200
From:      =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no>
To:        src-committers@freebsd.org
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org
Subject:   Re: 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/...
Message-ID:  <861vy71csr.fsf@ds4.des.no>
In-Reply-To: <200810231553.m9NFrqQj060598@svn.freebsd.org> (Dag-Erling Smorgrav's message of "Thu, 23 Oct 2008 15:53:52 %2B0000 (UTC)")
References:  <200810231553.m9NFrqQj060598@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Dag-Erling Smorgrav <des@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 =3D 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 =3D ($3)malloc$1/;
  s/\bFREE(\s*\()/free$1/;
'

DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?861vy71csr.fsf>