86 char *ret =
gp_vec_ins(self, off, strlen(src));
91 memcpy(ret+off, src, strlen(src));
109#define GP_VEC_STR_APPEND(self, str) ({\
110 char *gp_ret__ = gp_vec_str_append(self, str); \
A compiler dependent macros.
#define GP_WUR
Expands to warn_unused_result attribute when supported by the compiler.
#define GP_FMT_PRINTF(fmt, list)
Expands to format printf attribute when supported by the compiler.
Unicode helper macros and functions.
static unsigned int gp_utf8_bytes(uint32_t unicode)
Returns a number of bytes needed to store unicode character into UTF-8.
static int gp_to_utf8(uint32_t unicode, char *buf)
Writes an unicode character into a UTF-8 buffer.
Vector a growable and shrinkable array.
void * gp_vec_resize(void *self, size_t len)
Resize vector.
static size_t gp_vec_len(const void *self)
Returns vector lenght.
void * gp_vec_del(void *self, size_t off, size_t len)
Deletes a range from the vector.
void * gp_vec_new(size_t len, size_t unit)
Allocates a new vector.
void * gp_vec_ins(void *self, size_t off, size_t len)
Insert a gap into the vec of new elements, reallocating the underlying memory if more capacity is nee...
static char * gp_vec_str_new(void)
Allocated new string vector.
static char * gp_vec_chins(char *self, size_t off, char ch)
Inserts a string into a string vector at a given offset.
static size_t gp_vec_strlen(const char *self)
Returns string vector len.
static char * gp_vec_strins(char *self, size_t off, const char *src)
Inserts a string into a string vector at a given offset.
char * gp_vec_printf(char *self, const char *fmt,...)
Printf into a string vector.
static size_t gp_vec_strsize(const char *self)
Returns string vector size.
static char * gp_vec_str_append(char *self, const char *str)
Appends a string to a string vector.
static char * gp_vec_ins_utf8(char *self, size_t off, uint32_t unicode)
Inserts an unicode character into an UTF-8 string.
static char * gp_vec_strclr(char *self)
Clears the string.
static char * gp_vec_strdup(const char *src)
Copies a string into newly allocated string vector.
static char * gp_vec_strdel(char *self, size_t off, size_t len)
Deletes len characters from a string vector at a given offset.
char * gp_vec_vprintf(char *self, const char *fmt, va_list va)
Printf va_list into a string vector.