<p>Patch set 1:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4;">Code-Review -1</span></p><p><a href="https://gerrit.osmocom.org/12017">View Change</a></p><p>7 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/#/c/12017/1/include/osmocom/core/msgb.h">File include/osmocom/core/msgb.h:</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/12017/1/include/osmocom/core/msgb.h@569">Patch Set #1, Line 569:</a> <code style="font-family:monospace,monospace">bool msgb_cmpr(const char *f, size_t l, const struct msgb *msg, const uint8_t *data, size_t len, bool print);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">strcmp, so why not msgb_cmp instead of msgb_cmpr?</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/#/c/12017/1/src/msgb.c">File src/msgb.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/12017/1/src/msgb.c@176">Patch Set #1, Line 176:</a> <code style="font-family:monospace,monospace">static inline bool compare_n_print(const char *f, size_t l, uint8_t level,</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">remove inline, let the compiler decide what's more optimal.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/12017/1/src/msgb.c@196">Patch Set #1, Line 196:</a> <code style="font-family:monospace,monospace">    /* N. B: that's intended to be used bymsgb_cmpr*() so length check is already passed,</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">This comment needs to be moved to line 180 since len is already used there.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/12017/1/src/msgb.c@230">Patch Set #1, Line 230:</a> <code style="font-family:monospace,monospace">/*! Compare and print: check data in msgb against given data and print erros if any</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">typo: errors</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/12017/1/src/msgb.c@231">Patch Set #1, Line 231:</a> <code style="font-family:monospace,monospace"> *  \param[in] f text prefix, usually __func__, ignored if print == false</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">If it's based on print value, then it makes sense to move it at the end after print, not here at the start of the function.</p><p style="white-space: pre-wrap; word-wrap: break-word;">BTW, you should move these functions to have an underscore before it (_msg_cmp) and then have a define as msg_cmp(foo, bar) _msg_cmp(foo, bar, __FILE__, __LINE__).</p><p style="white-space: pre-wrap; word-wrap: break-word;">We do that in fsm.h check it.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/12017/1/src/msgb.c@232">Patch Set #1, Line 232:</a> <code style="font-family:monospace,monospace"> *  \param[in] l numeric prefix, usually __LINE__, ignored if print == false</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Same, move at the end.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/12017/1/src/msgb.c@239">Patch Set #1, Line 239:</a> <code style="font-family:monospace,monospace">bool msgb_cmpr(const char *f, size_t l, const struct msgb *msg, const uint8_t *data, size_t len, bool print)</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">I'd expect a msgb_cmp to compare two structs of msgb, so better calling this one msgb_cmp_data, in case we want to add the other one later.</p><p style="white-space: pre-wrap; word-wrap: break-word;">Now that we are adding the API, what about having it return an int like memcmp? after all we are using memcmp, so we can return an int.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/12017">change 12017</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/12017"/><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-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: I3bc95f2f5ab6e3f4b502647fb3e0aaaf1f7c4cf5 </div>
<div style="display:none"> Gerrit-Change-Number: 12017 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Max <msuraev@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: Pau Espin Pedrol <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Fri, 30 Nov 2018 11:44:47 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-HasLabels: Yes </div>