]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
utils: Undefine mem{cpy,move,set} if set before defining them
authorMartin Willi <martin@revosec.ch>
Mon, 7 Jul 2014 12:48:11 +0000 (14:48 +0200)
committerMartin Willi <martin@revosec.ch>
Mon, 7 Jul 2014 14:14:26 +0000 (16:14 +0200)
Some platforms, such as OS X, use macros for these functions. Undefine them
to avoid compiler warnings.

src/libstrongswan/utils/utils.h

index 66d91a59544d8f1591ce6f4b39cb613507fe877d..1b822dd6104dda6bc23e4448b42e3c57799e63fc 100644 (file)
@@ -175,6 +175,9 @@ static inline void *memcpy_noop(void *dst, const void *src, size_t n)
 {
        return n ? memcpy(dst, src, n) : dst;
 }
+#ifdef memcpy
+# undef memcpy
+#endif
 #define memcpy(d,s,n) memcpy_noop(d,s,n)
 
 /**
@@ -186,6 +189,9 @@ static inline void *memmove_noop(void *dst, const void *src, size_t n)
 {
        return n ? memmove(dst, src, n) : dst;
 }
+#ifdef memmove
+# undef memmove
+#endif
 #define memmove(d,s,n) memmove_noop(d,s,n)
 
 /**
@@ -197,6 +203,9 @@ static inline void *memset_noop(void *s, int c, size_t n)
 {
        return n ? memset(s, c, n) : s;
 }
+#ifdef memset
+# undef memset
+#endif
 #define memset(s,c,n) memset_noop(s,c,n)
 
 /**