Re: [PATCH 3/5] use SWAP macro
- From
René Scharfe <l.s.r@web.de>
- Date
- Jan 30, 2017, 17:18 UTC
- Message-ID
- <65b00711-bea1-a4e6-290b-1975319911c4@web.de>
- In-Reply-To
- <alpine.DEB.2.20.1701301702120.3469@virtualbox>
Am 30.01.2017 um 17:03 schrieb Johannes Schindelin:
Show 20 quoted lines
> Hi René,
>
> On Sat, 28 Jan 2017, René Scharfe wrote:
>
>> diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
>> index 806dd7a885..8ce00480cd 100644
>> --- a/builtin/diff-tree.c
>> +++ b/builtin/diff-tree.c
>> @@ -147,9 +147,7 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
>> tree1 = opt->pending.objects[0].item;
>> tree2 = opt->pending.objects[1].item;
>> if (tree2->flags & UNINTERESTING) {
>> - struct object *tmp = tree2;
>> - tree2 = tree1;
>> - tree1 = tmp;
>> + SWAP(tree2, tree1);
>> }
>
> Is there a way to transform away the curly braces for blocks that become
> single-line blocks, too?Interesting question. I guess this can be done by using a Python script (see contrib/coccinelle/strbuf.cocci for an example). I'll leave this as homework for readers interested in Coccinelle, at least for a while. :)
René