aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2023-07-08 00:05:41 +0700
committerfixeria <vyanitskiy@sysmocom.de>2023-07-07 22:21:28 +0000
commit918b0ceb6fb05a68c5a5fcb2e4bf4b1ff348c759 (patch)
tree47d3ab9c48a1bd53417f2c7937f87b352dc66e03
parentc87c6a3a7367e4a5ec14fb91b3470d475929eb0f (diff)
core: fix pointer access in msgb_l[1-4] macros
Put the 'm' pointer into braces, so that it's possible to pass an expression to these macros, e.g. a pointer-to-pointer dereference. This patch makes the following example compile: struct msgb **msg = /* ... */; return msgb_l2(*msg); /* <-- currently this fails */ Currently it fails with the following error: error: ‘msg’ is a pointer to pointer; did you mean to dereference it before applying ‘->’ to it? Change-Id: I2d19ea3c09ff9499314255d408fb71c07148fe25
-rw-r--r--include/osmocom/core/msgb.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/osmocom/core/msgb.h b/include/osmocom/core/msgb.h
index 2529c0e8..5c58c845 100644
--- a/include/osmocom/core/msgb.h
+++ b/include/osmocom/core/msgb.h
@@ -127,13 +127,13 @@ static inline struct msgb *msgb_dequeue_count(struct llist_head *queue,
#endif
/*! obtain L1 header of msgb */
-#define msgb_l1(m) ((void *)(m->l1h))
+#define msgb_l1(m) ((void *)((m)->l1h))
/*! obtain L2 header of msgb */
-#define msgb_l2(m) ((void *)(m->l2h))
+#define msgb_l2(m) ((void *)((m)->l2h))
/*! obtain L3 header of msgb */
-#define msgb_l3(m) ((void *)(m->l3h))
+#define msgb_l3(m) ((void *)((m)->l3h))
/*! obtain L4 header of msgb */
-#define msgb_l4(m) ((void *)(m->l4h))
+#define msgb_l4(m) ((void *)((m)->l4h))
/*! obtain SMS header of msgb */
#define msgb_sms(m) msgb_l4(m)