[Olsr-dev] [PATCH v1 1/3] defs: only define ARRAYSIZE when needed

Ferry Huberts (spam-protected)
Wed May 30 15:53:41 CEST 2012


From: Ferry Huberts <(spam-protected)>

To make mingw cross compilation on Fedora 17 work.

In file included from src/common/autobuf.h:47:0,
                 from src/common/autobuf.c:42:
src/defs.h:103:0: error: "ARRAYSIZE" redefined [-Werror]
In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/windef.h:137:0,
                 from /usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:69,
                 from /usr/i686-w64-mingw32/sys-root/mingw/include/winsock2.h:23,
                 from ./src/win32/sys/time.h:47,
                 from src/defs.h:46,
                 from src/common/autobuf.h:47,
                 from src/common/autobuf.c:42:
/usr/i686-w64-mingw32/sys-root/mingw/include/winnt.h:483:0: note: this is the location of the previous definition

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 src/defs.h |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/defs.h b/src/defs.h
index 06bac96..0688dd9 100644
--- a/src/defs.h
+++ b/src/defs.h
@@ -100,7 +100,9 @@ extern FILE *debug_handle;
 /* Returns TRUE if a timestamp is expired */
 #define TIMED_OUT(s1)	olsr_isTimedOut(s1)
 
+#ifndef ARRAYSIZE
 #define ARRAYSIZE(x)	(sizeof(x)/sizeof(*(x)))
+#endif
 #ifndef MAX
 #define MAX(x,y)	((x) > (y) ? (x) : (y))
 #endif
-- 
1.7.10.2





More information about the Olsr-dev mailing list