To reduce code duplication a little bit.

diff --git a/lib/libutil/imsg.h b/lib/libutil/imsg.h
index 8bf9414789b..8436e157b38 100644
--- a/lib/libutil/imsg.h
+++ b/lib/libutil/imsg.h
@@ -23,6 +23,7 @@
 
 #define IBUF_READ_SIZE         65535
 #define IMSG_HEADER_SIZE       sizeof(struct imsg_hdr)
+#define IMSG_DATA_SIZE(imsg)   ((imsg)->hdr.len - IMSG_HEADER_SIZE)
 #define MAX_IMSGSIZE           16384
 
 struct ibuf {
diff --git a/sbin/iked/iked.h b/sbin/iked/iked.h
index 49b7333c7b1..d95fbc0656e 100644
--- a/sbin/iked/iked.h
+++ b/sbin/iked/iked.h
@@ -64,7 +64,6 @@ struct imsgev {
        if (IMSG_DATA_SIZE(imsg) < sizeof(*p))                  \
                fatalx("bad length imsg received");             \
 } while (0)
-#define IMSG_DATA_SIZE(imsg)   ((imsg)->hdr.len - IMSG_HEADER_SIZE)
 
 #define IKED_ADDR_EQ(_a, _b)                                           \
        ((_a)->addr_mask == (_b)->addr_mask &&                          \
diff --git a/usr.sbin/httpd/httpd.h b/usr.sbin/httpd/httpd.h
index aff1a6c5e2a..f506ec13d05 100644
--- a/usr.sbin/httpd/httpd.h
+++ b/usr.sbin/httpd/httpd.h
@@ -195,7 +195,6 @@ struct imsgev {
        if (IMSG_DATA_SIZE(imsg) < sizeof(*p))                  \
                fatalx("bad length imsg received");             \
 } while (0)
-#define IMSG_DATA_SIZE(imsg)   ((imsg)->hdr.len - IMSG_HEADER_SIZE)
 #define MAX_IMSG_DATA_SIZE     (MAX_IMSGSIZE - IMSG_HEADER_SIZE)
 
 struct ctl_conn {
diff --git a/usr.sbin/relayd/relayd.h b/usr.sbin/relayd/relayd.h
index bcf47a6f709..4433c9455b6 100644
--- a/usr.sbin/relayd/relayd.h
+++ b/usr.sbin/relayd/relayd.h
@@ -897,7 +897,6 @@ struct imsgev {
        if (IMSG_DATA_SIZE(imsg) < sizeof(*p))                  \
                fatalx("bad length imsg received");             \
 } while (0)
-#define IMSG_DATA_SIZE(imsg)   ((imsg)->hdr.len - IMSG_HEADER_SIZE)
 
 struct ctl_conn {
        TAILQ_ENTRY(ctl_conn)    entry;
diff --git a/usr.sbin/snmpd/snmpd.h b/usr.sbin/snmpd/snmpd.h
index 6d93ac66144..b2bbe1ffa2e 100644
--- a/usr.sbin/snmpd/snmpd.h
+++ b/usr.sbin/snmpd/snmpd.h
@@ -105,7 +105,6 @@ struct imsgev {
        if (IMSG_DATA_SIZE(imsg) < sizeof(*p))                  \
                fatalx("bad length imsg received");             \
 } while (0)
-#define IMSG_DATA_SIZE(imsg)   ((imsg)->hdr.len - IMSG_HEADER_SIZE)
 
 /* initially control.h */
 struct control_sock {
diff --git a/usr.sbin/switchd/proc.h b/usr.sbin/switchd/proc.h
index f219d1c379d..1df8a2402bb 100644
--- a/usr.sbin/switchd/proc.h
+++ b/usr.sbin/switchd/proc.h
@@ -94,10 +94,6 @@ struct imsgev {
        const char              *name;
 };
 
-#ifndef IMSG_DATA_SIZE
-#define        IMSG_DATA_SIZE(_imsg)   ((_imsg)->hdr.len - IMSG_HEADER_SIZE)
-#endif
-
 #ifndef IMSG_SIZE_CHECK
 #define        IMSG_SIZE_CHECK(_imsg, _type)                           \
        do {                                                    \
diff --git a/usr.sbin/vmd/proc.h b/usr.sbin/vmd/proc.h
index b91f3a5fecb..48ac5736f5b 100644
--- a/usr.sbin/vmd/proc.h
+++ b/usr.sbin/vmd/proc.h
@@ -52,7 +52,6 @@ struct imsgev {
        if (IMSG_DATA_SIZE(imsg) < sizeof(*p))                          \
                fatalx("bad length imsg received (%s)", #p);            \
 } while (0)
-#define IMSG_DATA_SIZE(imsg)   ((imsg)->hdr.len - IMSG_HEADER_SIZE)
 
 /* control socket */
 struct control_sock {

Reply via email to