defs: only define ARRAYSIZE when needed
authorFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 30 May 2012 13:46:06 +0000 (15:46 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 31 May 2012 19:39:05 +0000 (21:39 +0200)
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 <ferry.huberts@pelagic.nl>
src/defs.h

index 06bac96..0688dd9 100644 (file)
@@ -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