add missing #define
authorChristian Grothoff <christian@grothoff.org>
Sun, 13 May 2018 19:18:49 +0000 (21:18 +0200)
committerChristian Grothoff <christian@grothoff.org>
Sun, 13 May 2018 19:18:49 +0000 (21:18 +0200)
src/nat/gnunet-helper-nat-client.c
src/nat/gnunet-helper-nat-server.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.
  */
index f35649152622d56a97c74f712b42db70f7405596..b8f499b4d06f6e88e718f29015eb50e7a8d521b5 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)
+
 /**
  * Should we print some debug output?
  */