aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/garray.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/garray.c')
-rw-r--r--src/nvim/garray.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/nvim/garray.c b/src/nvim/garray.c
index 1cfc2b6176..bc3b7211c9 100644
--- a/src/nvim/garray.c
+++ b/src/nvim/garray.c
@@ -5,16 +5,16 @@
///
/// Functions for handling growing arrays.
-#include <string.h>
#include <inttypes.h>
+#include <string.h>
-#include "nvim/vim.h"
#include "nvim/ascii.h"
+#include "nvim/garray.h"
#include "nvim/log.h"
#include "nvim/memory.h"
#include "nvim/path.h"
-#include "nvim/garray.h"
#include "nvim/strings.h"
+#include "nvim/vim.h"
// #include "nvim/globals.h"
#include "nvim/memline.h"
@@ -146,11 +146,11 @@ void ga_remove_duplicate_strings(garray_T *gap)
char_u *ga_concat_strings_sep(const garray_T *gap, const char *sep)
FUNC_ATTR_NONNULL_RET
{
- const size_t nelem = (size_t) gap->ga_len;
+ const size_t nelem = (size_t)gap->ga_len;
const char **strings = gap->ga_data;
if (nelem == 0) {
- return (char_u *) xstrdup("");
+ return (char_u *)xstrdup("");
}
size_t len = 0;
@@ -169,7 +169,7 @@ char_u *ga_concat_strings_sep(const garray_T *gap, const char *sep)
}
strcpy(s, strings[nelem - 1]);
- return (char_u *) ret;
+ return (char_u *)ret;
}
/// For a growing array that contains a list of strings: concatenate all the
@@ -178,7 +178,7 @@ char_u *ga_concat_strings_sep(const garray_T *gap, const char *sep)
/// @param gap
///
/// @returns the concatenated strings
-char_u* ga_concat_strings(const garray_T *gap) FUNC_ATTR_NONNULL_RET
+char_u *ga_concat_strings(const garray_T *gap) FUNC_ATTR_NONNULL_RET
{
return ga_concat_strings_sep(gap, ",");
}
@@ -198,7 +198,7 @@ void ga_concat(garray_T *gap, const char_u *restrict s)
return;
}
- ga_concat_len(gap, (const char *restrict) s, strlen((char *) s));
+ ga_concat_len(gap, (const char *restrict)s, strlen((char *)s));
}
/// Concatenate a string to a growarray which contains characters
@@ -206,15 +206,14 @@ void ga_concat(garray_T *gap, const char_u *restrict s)
/// @param[out] gap Growarray to modify.
/// @param[in] s String to concatenate.
/// @param[in] len String length.
-void ga_concat_len(garray_T *const gap, const char *restrict s,
- const size_t len)
+void ga_concat_len(garray_T *const gap, const char *restrict s, const size_t len)
FUNC_ATTR_NONNULL_ALL
{
if (len) {
- ga_grow(gap, (int) len);
+ ga_grow(gap, (int)len);
char *data = gap->ga_data;
memcpy(data + gap->ga_len, s, len);
- gap->ga_len += (int) len;
+ gap->ga_len += (int)len;
}
}