Re: [PATCH v4 5/6] convert: add 'working-tree-encoding' attribute
From: Jeff King <hidden>
Date: 2018-01-23 16:20:22
On Tue, Jan 23, 2018 at 11:25:58AM +0100, Simon Ruderich wrote:
On Mon, Jan 22, 2018 at 07:54:01PM -0500, Jeff King wrote:quoted
But anyway, that was a bit of a tangent. Certainly the smaller change is just standardizing on sizeof(*foo), which I think most people agree on at this point. It might be worth putting in CodingGuidelines.Personally I prefer sizeof(*foo) which is a well non-idiom, used in many projects and IMHO easy to read and understand.
Me too.
I've played a little with coccinelle and the following spatch seems to catch many occurrences of sizeof(struct ..) (the first hunk seems to expand multiple times causing conflicts in the generated patch). Cases like a->b = xcalloc() are not matched, I don't know enough coccinelle for that. If there's interest I could prepare patches, but it will create quite some code churn.
Yeah, I'm not sure what our current policy is there. Traditionally our strategy was not to churn code, but to update old idioms as they were touched. Especially if the change was not urgent, but mostly stylistic (which this one is). But with Coccinelle, it's a lot easier to apply the change tree-wide, and to convert topics in flight as they get merged. The maintainer still gets conflicts with topics-in-flight that touch converted areas, though. So I'd be curious to hear if Junio's opinion has changed at all. -Peff