提交 ac7b9004 编写于 作者: P Peter Zijlstra 提交者: Linus Torvalds

generic swap(): don't return a value from swap()

The swap() macro is accidentally retuning the value of its first argument.
Change it into a doesn't-return-anything macro before someone goes and
relies upon this behaviour.
Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 c073b2db
...@@ -480,7 +480,8 @@ static inline char *pack_hex_byte(char *buf, u8 byte) ...@@ -480,7 +480,8 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
/* /*
* swap - swap value of @a and @b * swap - swap value of @a and @b
*/ */
#define swap(a, b) ({ typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; }) #define swap(a, b) \
do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
/** /**
* container_of - cast a member of a structure out to the containing structure * container_of - cast a member of a structure out to the containing structure
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册