Merge branch 'master' of gnunet.org:gnunet
[oweals/gnunet.git] / src / nat / gnunet-helper-nat-client.c
index 9768dd856362e0919e5ee63ccd484a28d7304933..359e529b0f3ed4b3814b6676dba64f95f5e93c56 100644 (file)
 #define ICMP_TIME_EXCEEDED 11
 #endif
 
+/**
+ * Call memcpy() but check for @a n being 0 first. In the latter
+ * case, it is now safe to pass NULL for @a src or @a dst.
+ * Unlike traditional memcpy(), returns nothing.
+ *
+ * @param dst destination of the copy, may be NULL if @a n is zero
+ * @param src source of the copy, may be NULL if @a n is zero
+ * @param n number of bytes to copy
+ */
+#define GNUNET_memcpy(dst,src,n) do { if (0 != n) { (void) memcpy (dst,src,n); } } while (0)
+
 /**
  * Must match IP given in the server.
  */