Change in libosmocore[master]: ctrl: Pre-calculate required size before allocating msgb

dexter gerrit-no-reply at
Fri Jun 11 20:34:39 UTC 2021

dexter has posted comments on this change. ( )

Change subject: ctrl: Pre-calculate required size before allocating msgb

Patch Set 1: Code-Review+1

File tests/ctrl/ctrl_test.c: 
PS1, Line 120: 
> It's not unrelated, I explain why is it related in the commit description. […]
I guess we can not simply do an msgb_put_u8 anymore to make sure that the string in sent_msg is terminated because the messages now are exactly as long as the string so we need to copy it into a buffer first. osmo_escape_str() would probably also not work, it has to store the terminating 0 also somewhere. I think this makes sense and it also means that this change is not unrelated. Maybe a comment about this may help to understand it better. 
PS1, Line 121: 		char *strbuf = talloc_size(sent_msg, msgb_l2len(sent_msg) + 1);
> (osmo style would want to declare char *strbuf above the OSMO_ASSERT)
Declaring variables in the middle of the code may not be supported by older compilers anyway. I would declare it at the top of the function... - but if gcc eats it - why not?

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I0b8f370f7b08736207f9efed13a0663b5e482824
Gerrit-Change-Number: 24639
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at>
Gerrit-Reviewer: keith <keith at>
Gerrit-Reviewer: laforge <laforge at>
Gerrit-Reviewer: neels <nhofmeyr at>
Gerrit-Comment-Date: Fri, 11 Jun 2021 20:34:39 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: neels <nhofmeyr at>
Comment-In-Reply-To: pespin <pespin at>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list