Re: generic swap()

From: Andrew Morton
Date: Fri Jan 16 2009 - 04:39:34 EST


On Fri, 16 Jan 2009 10:26:34 +0100 Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> Hi,
>
> Where did this patch come from? -- I can't seem to find it on lkml at all..

That's a damn good question. I received:

From: Wu Fengguang <fengguang.wu@xxxxxxxxx>
To: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: LKML <linux-kernel@xxxxxxxxxxxxxxx>
Subject: [PATCH 0/9] [PATCH] make swap() a global macro
Date: Tue, 02 Dec 2008 19:45:24 +0800
User-Agent: quilt/0.46-1

but the cc didn't seem to work. quilt bustage?

> The reason I ask it that I wonder why swap() has a return value?

Accident, I guess.

> +#define swap(a, b) ({ typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; })

You think it should use the do{}while(0) thing?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/