1 | #ifndef NVIM_STRINGS_H |
---|---|
2 | #define NVIM_STRINGS_H |
3 | |
4 | #include <stdbool.h> |
5 | #include <stdarg.h> |
6 | #include <string.h> |
7 | |
8 | #include "nvim/types.h" |
9 | #include "nvim/eval/typval.h" |
10 | |
11 | /// Append string to string and return pointer to the next byte |
12 | /// |
13 | /// Unlike strcat, this one does *not* add NUL byte and returns pointer to the |
14 | /// past of the added string. |
15 | /// |
16 | /// @param[out] dst String to append to. |
17 | /// @param[in] src String to append. |
18 | /// |
19 | /// @return pointer to the byte just past the appended byte. |
20 | static inline char *strappend(char *const dst, const char *const src) |
21 | FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT |
22 | FUNC_ATTR_NONNULL_RET |
23 | { |
24 | const size_t src_len = strlen(src); |
25 | return (char *)memmove(dst, src, src_len) + src_len; |
26 | } |
27 | |
28 | #ifdef INCLUDE_GENERATED_DECLARATIONS |
29 | # include "strings.h.generated.h" |
30 | #endif |
31 | #endif // NVIM_STRINGS_H |
32 |