]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
macro: add swap helper
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 18 Feb 2021 10:23:30 +0000 (11:23 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 18 Feb 2021 10:54:32 +0000 (11:54 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/macro.h

index 9e74078f4ef7033a6ee2a465cb3fc963b363e4a9..f6ac8c45f6cfa41c3a61ee804de6c9a3a66b8f35 100644 (file)
@@ -694,4 +694,11 @@ enum {
 
 #define MAX_FILENO ~0U
 
+#define swap(a, b)                     \
+       do {                           \
+               typeof(a) __tmp = (a); \
+               (a) = (b);             \
+               (b) = __tmp;           \
+       } while (0)
+
 #endif /* __LXC_MACRO_H */