[S] Change in libosmocore[master]: core: fix pointer access in msgb_l[1-4] macros
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/33646 ) Change subject: core: fix pointer access in msgb_l[1-4] macros ...................................................................... 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 --- M include/osmocom/core/msgb.h 1 file changed, 26 insertions(+), 4 deletions(-) Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/core/msgb.h b/include/osmocom/core/msgb.h index 2529c0e..5c58c84 100644 --- a/include/osmocom/core/msgb.h +++ b/include/osmocom/core/msgb.h @@ -127,13 +127,13 @@ #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) -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/33646 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I2d19ea3c09ff9499314255d408fb71c07148fe25 Gerrit-Change-Number: 33646 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: pespin <pespin@sysmocom.de> Gerrit-MessageType: merged
participants (1)
-
fixeria