Change in osmo-sgsn[master]: llc: gprs_llc_hdr_parse(): make the input data pointer const
Attention is currently required from: osmith, pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/29279 ) Change subject: llc: gprs_llc_hdr_parse(): make the input data pointer const ...................................................................... Patch Set 1: (1 comment) File src/gprs/gprs_llc_parse.c: https://gerrit.osmocom.org/c/osmo-sgsn/+/29279/comment/cf293d55_660c0822 PS1, Line 138: ghp->data = (uint8_t *)&ctrl[3];
The compiler may make optimizations based on what passed to the function. […] The main point of using const is *not* to assist the compiler in optimizations but to protect yourself from mistakes... I am telling the API user that gprs_llc_hdr_parse() does not modify the given buffer, that's it. I would agree with you if I were actually changing the given buffer here via a const pointer, or were passing it to some other function which does so. What I am doing here and below is storing an address.
-- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/29279 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: I9757d2be5af589ccbe4d3d406637a33690284754 Gerrit-Change-Number: 29279 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: osmith <osmith@sysmocom.de> Gerrit-CC: pespin <pespin@sysmocom.de> Gerrit-Attention: osmith <osmith@sysmocom.de> Gerrit-Attention: pespin <pespin@sysmocom.de> Gerrit-Comment-Date: Wed, 07 Sep 2022 09:19:27 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin@sysmocom.de> Comment-In-Reply-To: fixeria <vyanitskiy@sysmocom.de> Gerrit-MessageType: comment
participants (1)
-
fixeria