diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-04-27 09:25:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-27 09:25:02 +0200 |
commit | 53f11dcfc7139fe6c8a6b114db4bfec5d91005a9 (patch) | |
tree | e9bfbaf10fc6681bbbcba0a0eabdce8a6f6840b5 /src/nvim/memory.c | |
parent | 009ccfe170ada2c78ca7feabda567a7e901fb30b (diff) | |
parent | 4ce8521ee4a72e050bd187c2986708c5f98c7442 (diff) | |
download | rneovim-53f11dcfc7139fe6c8a6b114db4bfec5d91005a9.tar.gz rneovim-53f11dcfc7139fe6c8a6b114db4bfec5d91005a9.tar.bz2 rneovim-53f11dcfc7139fe6c8a6b114db4bfec5d91005a9.zip |
Merge #8218 'Fix errors reported by PVS'
closes #4983
Diffstat (limited to 'src/nvim/memory.c')
-rw-r--r-- | src/nvim/memory.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/nvim/memory.c b/src/nvim/memory.c index a66ab6a3cc..bfc2f208dd 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -369,10 +369,12 @@ char *xstpncpy(char *restrict dst, const char *restrict src, size_t maxlen) /// string that fits in the buffer (unless, of course, the buffer size is /// zero). It does not pad out the result like strncpy() does. /// -/// @param dst Buffer to store the result -/// @param src String to be copied -/// @param dsize Size of `dst` -/// @return strlen(src). If retval >= dstsize, truncation occurs. +/// @param[out] dst Buffer to store the result. +/// @param[in] src String to be copied. +/// @param[in] dsize Size of `dst`. +/// +/// @return Length of `src`. May be greater than `dsize - 1`, which would mean +/// that string was truncated. size_t xstrlcpy(char *restrict dst, const char *restrict src, size_t dsize) FUNC_ATTR_NONNULL_ALL { @@ -394,11 +396,13 @@ size_t xstrlcpy(char *restrict dst, const char *restrict src, size_t dsize) /// @see vim_strcat from Vim. /// @see strlcat from OpenBSD. /// -/// @param dst Buffer to be appended-to. Must have a NUL byte. -/// @param src String to put at the end of `dst` -/// @param dsize Size of `dst` including NUL byte. Must be greater than 0. -/// @return strlen(src) + strlen(initial dst) -/// If retval >= dsize, truncation occurs. +/// @param[in,out] dst Buffer to be appended-to. Must have a NUL byte. +/// @param[in] src String to put at the end of `dst`. +/// @param[in] dsize Size of `dst` including NUL byte. Must be greater than 0. +/// +/// @return Length of the resulting string as if destination size was #SIZE_MAX. +/// May be greater than `dsize - 1`, which would mean that string was +/// truncated. size_t xstrlcat(char *const dst, const char *const src, const size_t dsize) FUNC_ATTR_NONNULL_ALL { |