Functions
garray.c File Reference
#include <string.h>
#include <inttypes.h>
#include "nvim/vim.h"
#include "nvim/ascii.h"
#include "nvim/log.h"
#include "nvim/memory.h"
#include "nvim/path.h"
#include "nvim/garray.h"
#include "nvim/strings.h"
#include "nvim/memline.h"

Functions

void ga_clear (garray_T *gap)
 Clear an allocated growing array. More...
 
void ga_clear_strings (garray_T *gap)
 
void ga_init (garray_T *gap, int itemsize, int growsize)
 
void ga_set_growsize (garray_T *gap, int growsize)
 
void ga_grow (garray_T *gap, int n)
 
void ga_remove_duplicate_strings (garray_T *gap)
 
char_uga_concat_strings_sep (const garray_T *gap, const char *sep) FUNC_ATTR_NONNULL_RET
 
char_uga_concat_strings (const garray_T *gap) FUNC_ATTR_NONNULL_RET
 
void ga_concat (garray_T *gap, const char_u *restrict s)
 
void ga_concat_len (garray_T *const gap, const char *restrict s, const size_t len) FUNC_ATTR_NONNULL_ALL
 
void ga_append (garray_T *gap, char c)
 

Detailed Description

Functions for handling growing arrays.

Function Documentation

void ga_append ( garray_T gap,
char  c 
)

Append one byte to a growarray which contains bytes.

Parameters
gap
c
void ga_clear ( garray_T gap)

Clear an allocated growing array.

void ga_clear_strings ( garray_T gap)

Clear a growing array that contains a list of strings.

Parameters
gap
void ga_concat ( garray_T gap,
const char_u *restrict  s 
)

Concatenate a string to a growarray which contains characters. When "s" is NULL does not do anything.

WARNING:

  • Does NOT copy the NUL at the end!
  • The parameter may not overlap with the growing array
Parameters
gap
s
void ga_concat_len ( garray_T *const  gap,
const char *restrict  s,
const size_t  len 
)

Concatenate a string to a growarray which contains characters

Parameters
[out]gapGrowarray to modify.
[in]sString to concatenate.
[in]lenString length.
char_u* ga_concat_strings ( const garray_T gap)

For a growing array that contains a list of strings: concatenate all the strings with a separating comma.

Parameters
gap
Returns
the concatenated strings
char_u* ga_concat_strings_sep ( const garray_T gap,
const char *  sep 
)

For a growing array that contains a list of strings: concatenate all the strings with sep as separator.

Parameters
gap
sep
Returns
the concatenated strings
void ga_grow ( garray_T gap,
int  n 
)

Make room in growing array "gap" for at least "n" items.

Parameters
gap
n
void ga_init ( garray_T gap,
int  itemsize,
int  growsize 
)

Initialize a growing array.

Parameters
gap
itemsize
growsize
void ga_remove_duplicate_strings ( garray_T gap)

Sort "gap" and remove duplicate entries. "gap" is expected to contain a list of file names in allocated memory.

Parameters
gap
void ga_set_growsize ( garray_T gap,
int  growsize 
)

A setter for the growsize that guarantees it will be at least 1.

Parameters
gap
growsize