<p>Patch set 12:<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/c/libosmocore/+/19415">View Change</a></p><p>10 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/19415/11/src/socket.c">File src/socket.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/+/19415/11/src/socket.c@1562">Patch Set #11, Line 1562:</a> <code style="font-family:monospace,monospace">/*! Compare two osmo_sockaddr. Return 0 if they are same</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">"the same". End with a ".". Actually the \return is already below.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19415/11/src/socket.c@1563">Patch Set #11, Line 1563:</a> <code style="font-family:monospace,monospace"> * \brief osmo_sockaddr_cmp</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">we use AUTO_BRIEF, so drop this \brief line</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19415/11/src/socket.c@1566">Patch Set #11, Line 1566:</a> <code style="font-family:monospace,monospace"> * \return 0 if a and b are equal.</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">the naming of "cmp" implies being able to use the return code for sorting.<br>So please return 1 if a > b and -1 if a < b.</p><p style="white-space: pre-wrap; word-wrap: break-word;">If you don't want to do that, s/_cmp/_same</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19415/11/src/socket.c@1568">Patch Set #11, Line 1568:</a> <code style="font-family:monospace,monospace">int osmo_sockaddr_cmp(struct osmo_sockaddr *a, struct osmo_sockaddr *b)</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">As usual, I see no point in checking and returning stuff for NULL pointers. […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">I strongly favor generic cmp functions being useful with NULL args as well, it's not much effort and gives a warm and comfortable peace of mind</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19415/11/src/socket.c@1570">Patch Set #11, Line 1570:</a> <code style="font-family:monospace,monospace">   if (!a && !b)</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">this could be just</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">  if (a == b)<br>      return 0;</pre></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19415/11/src/socket.c@1573">Patch Set #11, Line 1573:</a> <code style="font-family:monospace,monospace">               return 1;</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">-1</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19415/11/src/socket.c@1577">Patch Set #11, Line 1577:</a> <code style="font-family:monospace,monospace">           return 1;</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">return OSMO_CMP(a->.., b->..)</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19415/11/src/socket.c@1583">Patch Set #11, Line 1583:</a> <code style="font-family:monospace,monospace">                   a->u.sin.sin_port == b->u.sin.sin_port);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">cleaner, type wise, would be to return <condition> ? 0 : 1</p><p style="white-space: pre-wrap; word-wrap: break-word;">not sure how to do proper cmp rc of -1/1 here... at least the port could use OSMO_CMP()</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19415/11/src/socket.c@1585">Patch Set #11, Line 1585:</a> <code style="font-family:monospace,monospace">             /* AF_INET6 usally not contain any padding */</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">"does not"</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/19415/11/src/socket.c@1588">Patch Set #11, Line 1588:</a> <code style="font-family:monospace,monospace">             /* fallback to memcmp for remaing AF */</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">"remaining"</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/19415">change 19415</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/+/19415"/><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: I2d12ebae2710ffd17cf071e6ada0804e73f87dd6 </div>
<div style="display:none"> Gerrit-Change-Number: 19415 </div>
<div style="display:none"> Gerrit-PatchSet: 12 </div>
<div style="display:none"> Gerrit-Owner: lynxis lazus <lynxis@fe80.eu> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: lynxis lazus <lynxis@fe80.eu> </div>
<div style="display:none"> Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Thu, 27 Aug 2020 11:14:20 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: Yes </div>
<div style="display:none"> Comment-In-Reply-To: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: comment </div>