summaryrefslogtreecommitdiffstats
path: root/include/c.h
diff options
context:
space:
mode:
authorKarel Zak2010-03-16 15:24:04 +0100
committerKarel Zak2010-03-16 15:24:04 +0100
commit70502c5246815c35dba4d062ef4152d71b827ef8 (patch)
treed0655b68fa2f3b30d55fc5124a3dbd8fa39533d4 /include/c.h
parentcal: factor out and update multibyte alignment code (diff)
downloadkernel-qcow2-util-linux-70502c5246815c35dba4d062ef4152d71b827ef8.tar.gz
kernel-qcow2-util-linux-70502c5246815c35dba4d062ef4152d71b827ef8.tar.xz
kernel-qcow2-util-linux-70502c5246815c35dba4d062ef4152d71b827ef8.zip
lib: add #ifndef around min() max() macros
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'include/c.h')
-rw-r--r--include/c.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/c.h b/include/c.h
index 6615f6fea..577b8a809 100644
--- a/include/c.h
+++ b/include/c.h
@@ -46,17 +46,20 @@
# define FALSE 0
#endif
-
-#define min(x, y) ({ \
+#ifndef min
+# define min(x, y) ({ \
typeof(x) _min1 = (x); \
typeof(y) _min2 = (y); \
(void) (&_min1 == &_min2); \
_min1 < _min2 ? _min1 : _min2; })
+#endif
-#define max(x, y) ({ \
+#ifndef max
+# define max(x, y) ({ \
typeof(x) _max1 = (x); \
typeof(y) _max2 = (y); \
(void) (&_max1 == &_max2); \
_max1 > _max2 ? _max1 : _max2; })
+#endif
#endif /* UTIL_LINUX_C_H */