Re: [PATCH] git-compat-util.h: introduce CALLOC(x)
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Dec 5, 2022, 22:36 UTC
- Message-ID
- <Y45yaYV3xFB/xR2G@nand.local>
- In-Reply-To
- <a8e33b1e-1056-5f75-55b5-65c0bceef3ca@web.de>
On Mon, Dec 05, 2022 at 10:01:11PM +0100, René Scharfe wrote:
Show 13 quoted lines
> This rule would turn this code: > > struct foo *bar = xcalloc(1, sizeof(*bar)); > int i; > > ... into: > > struct foo *bar; > CALLOC(bar); > int i; > > ... which violates the coding guideline to not mix declarations and > statements (-Wdeclaration-after-statement).
Yeah, I was wondering about this myself when I wrote this part of the Coccinelle patch.
Is there an intelligent way to tell it to put the first statement after all declarations? I couldn't find anything after a quick scan of the documentation nor our own patches.
Thanks, Taylor