[PATCH] libosmocore[master]: doc: clarify osmo_strlcpy() doc

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Fri Jan 13 13:41:27 UTC 2017


Review at  https://gerrit.osmocom.org/1596

doc: clarify osmo_strlcpy() doc

Stating that it 'truncates src' is misleading. Also clarify whether siz
includes the space needed for the terminating NUL.

Change-Id: I01c1a94408b471f7f54576178a60938bf9ee3261
---
M src/utils.c
1 file changed, 5 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/96/1596/1

diff --git a/src/utils.c b/src/utils.c
index 02c2443..df806df 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -343,12 +343,12 @@
 /*! \brief Copy a C-string into a sized buffer
  *  \param[in] src source string
  *  \param[out] dst destination string
- *  \param[in] siz size of the \a dst string
- *  \returns length of source string
+ *  \param[in] siz size of the \a dst buffer
+ *  \returns length of \a src
  *
- *  Copies up to \a siz characters from \a src to \a dst, but ensures
- *  that the last character of \a dst is always a NUL character.  May
- *  truncate \a src to do achieve this.
+ * Copy at most \a siz bytes from \a src to \a dst, ensuring that the result is
+ * NUL terminated. The NUL character is included in \a siz, i.e. passing the
+ * actual sizeof(*dst) is correct.
  */
 size_t osmo_strlcpy(char *dst, const char *src, size_t siz)
 {

-- 
To view, visit https://gerrit.osmocom.org/1596
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I01c1a94408b471f7f54576178a60938bf9ee3261
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list