Re: [PATCH v7 06/13] pack-objects: move in_pack out of struct object_entry
From: Jeff King <hidden>
Date: 2018-03-31 10:20:14
On Sat, Mar 31, 2018 at 06:51:10AM +0200, Duy Nguyen wrote:
quoted
quoted
+#define IN_PACK(obj) oe_in_pack(&to_pack, obj)How come this one gets a macro, but the earlier conversions don't? I guess the problem is that oe_in_pack() is defined in the generic pack-objects.h, but &to_pack is only in builtin/pack-objects.c? I wonder if it would be that bad to just say oe_in_pack(&to_pack, obj) everywhere. It's longer, but it makes the code slightly less magical to read.Longer was exactly why I added these macros (with the hope that the macro upper case names already ring a "it's magical" bell). Should I drop all these macros? Some code becomes a lot more verbose though.
I'm on the fence. I agree that the macro screams "magical". I just sometimes see a macro and think something really weird and unfunction-like is going on. But really we're just replacing a default parameter. So I dunno. If you get rid of the macros and I look at it, I give even odds that I'll say "yech, put them back!". :) -Peff