Re: [PATCH 3/5] use SWAP macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 30.01.2017 um 23:22 schrieb Junio C Hamano:
René Scharfe <l.s.r@xxxxxx> writes:

 		if (tree2->flags & UNINTERESTING) {
-			struct object *tmp = tree2;
-			tree2 = tree1;
-			tree1 = tmp;
+			SWAP(tree2, tree1);

A human would have written this SWAP(tree1, tree2).

Not that I think such a manual fix-up should be made in _this_
patch, which may end up mixing mechanical conversion (which we may
want to keep reproducible) and hand tweaks.  But this swapped swap
reads somewhat silly.

Well, a human wrote "tmp = tree2" -- sometimes one likes to count down instead of up, I guess.

We can make Coccinelle order the parameters alphabetically, but I don't know how to do so without duplicating most of the semantic patch. And thats would result in e.g. SWAP(new_tree, old_tree), which might be odd as well.

I'd just leave them in whatever order they were, but that's probably because I'm lazy.

René



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]