<p>laforge <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/15779">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">tdef: Return correct snprintf value for osmo_tdef_range_str_buf()<br><br>len provides extra information in the case the buffer was too small,<br>because it tells the caller "the number of characters (excluding the<br>terminating null byte) which would have been written to the final<br>string if enough space had been available" (man<br>snprintf).<br><br>Change-Id: Icafe559e19a92e2ae72fdd0dd2d9a394b1eda878<br>---<br>M src/tdef.c<br>1 file changed, 4 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/tdef.c b/src/tdef.c</span><br><span>index 94d987f..71a3315 100644</span><br><span>--- a/src/tdef.c</span><br><span>+++ b/src/tdef.c</span><br><span>@@ -256,7 +256,9 @@</span><br><span>  * \param[in] buf  The buffer where the string representation is stored.</span><br><span>  * \param[in] buf_len  Length of buffer in bytes.</span><br><span>  * \param[in] tdef  Timer entry from a timer definition table.</span><br><span style="color: hsl(0, 100%, 40%);">- * \return The number of characters printed on success, negative on error. See snprintf().</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return The number of characters printed on success (or number of characters</span><br><span style="color: hsl(120, 100%, 40%);">+ *         which would have been written to the final string if enough space</span><br><span style="color: hsl(120, 100%, 40%);">+ *         had been available), negative on error. See snprintf().</span><br><span>  */</span><br><span> int osmo_tdef_range_str_buf(char *buf, size_t buf_len, struct osmo_tdef *t)</span><br><span> {</span><br><span>@@ -275,7 +277,7 @@</span><br><span>   if (ret < 0)</span><br><span>              return ret;</span><br><span>  OSMO_SNPRINTF_RET(ret, rem, offset, len);</span><br><span style="color: hsl(0, 100%, 40%);">-       return ret;</span><br><span style="color: hsl(120, 100%, 40%);">+   return len;</span><br><span> }</span><br><span> </span><br><span> /*! Using osmo_tdef for osmo_fsm_inst: find a given state's osmo_tdef_state_timeout entry.</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/15779">change 15779</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/+/15779"/><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: Icafe559e19a92e2ae72fdd0dd2d9a394b1eda878 </div>
<div style="display:none"> Gerrit-Change-Number: 15779 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: fixeria <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>