<p><a href="https://gerrit.osmocom.org/c/libosmocore/+/17604">View Change</a></p><p>1 comment:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/17604/2/src/logging.c">File src/logging.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/17604/2/src/logging.c@1064">Patch Set #2, Line 1064:</a> <code style="font-family:monospace,monospace">*(uint8_t*) (&</code></p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">I think the only proper way t osolve it is to copy the entire 'const' array of 'cat' into dynamically allocated memory, and then make modifications there.</p></blockquote><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">we should dynamically allocate memory for 'cat' here in this function, then copy over the contents of 'cat' from osmo_log_info [...]</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">Right, that's exactly how we do this.</p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">[...] and make the changes there. When done we assign osmo_log_info->cat with the location of the copy we just created. Is this correct?</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">Vice versa. In the current code (with this patch applied) we allocate memory and immediately assign it to osmo_log_info->cat (line 1046), and then we make changes by casting const pointers to non-const.</p><p style="white-space: pre-wrap; word-wrap: break-word;">I am fine with proposed patch, but ideally we should use a temporary non-const pointer to make changes, and then assign it to osmo_log_info->cat (as was proposed in a comment near line 1046).</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/17604">change 17604</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/libosmocore/+/17604"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ib9e180261505062505fc4605a98023910f76cde6 </div>
<div style="display:none"> Gerrit-Change-Number: 17604 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-CC: fixeria <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Sun, 12 Apr 2020 09:10:45 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Comment-In-Reply-To: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Comment-In-Reply-To: fixeria <axilirator@gmail.com> </div>
<div style="display:none"> Comment-In-Reply-To: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: comment </div>