aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/strings.h
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2018-04-08 19:21:44 +0300
committerZyX <kp-pav@yandex.ru>2018-04-09 10:29:28 +0300
commit58a5699a4400d1d706056e456ca641b3e4b0a5e9 (patch)
treef80f18b1ffc6d27ba40f3f7fd5694e8469b0187e /src/nvim/strings.h
parent2a6491cdf86709abd2a7c7920e190c1a802b4f26 (diff)
downloadrneovim-58a5699a4400d1d706056e456ca641b3e4b0a5e9.tar.gz
rneovim-58a5699a4400d1d706056e456ca641b3e4b0a5e9.tar.bz2
rneovim-58a5699a4400d1d706056e456ca641b3e4b0a5e9.zip
buffer: PVS/V557: Refactor maketitle()
Diffstat (limited to 'src/nvim/strings.h')
-rw-r--r--src/nvim/strings.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/nvim/strings.h b/src/nvim/strings.h
index 59b8701a3f..f2876c6307 100644
--- a/src/nvim/strings.h
+++ b/src/nvim/strings.h
@@ -3,10 +3,28 @@
#include <stdbool.h>
#include <stdarg.h>
+#include <string.h>
#include "nvim/types.h"
#include "nvim/eval/typval.h"
+/// Append string to string and return pointer to the next byte
+///
+/// Unlike strcat, this one does *not* add NUL byte and returns pointer to the
+/// past of the added string.
+///
+/// @param[out] dst String to append to.
+/// @param[in] src String to append.
+///
+/// @return pointer to the byte just past the appended byte.
+static inline char *strappend(char *const dst, const char *const src)
+ FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
+ FUNC_ATTR_NONNULL_RET
+{
+ const size_t src_len = strlen(src);
+ return (char *)memmove(dst, src, src_len) + src_len;
+}
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "strings.h.generated.h"
#endif