limb 0.2.0

2024-01-09

stralloc_cat(3)
limb manual
stralloc_cat(3)

NAME

stralloc_catb, stralloc_cats, stralloc_cats0, stralloc_catv, stralloc_cat, stralloc_copyb, stralloc_copys, stralloc_copys0, stralloc_copy, stralloc_insertb, stralloc_inserts, stralloc_inserts0, stralloc_insert, stralloc_append, stralloc_0 - adding data into a stralloc

SYNOPSIS

#include <limb/stralloc.h>
int stralloc_catb(stralloc *sa, const char *data, size_t dlen)
int stralloc_cats(stralloc *sa, const char *str)
int stralloc_cats0(stralloc *sa, const char *str)
int stralloc_catv(stralloc *sa, const struct iovec *v, unsigned n)
int stralloc_cat(stralloc *sa, const stralloc *sasce)

int stralloc_copyb(stralloc *sa, const char *data, size_t dlen)
int stralloc_copys(stralloc *sa, const char *str)
int stralloc_copys0(stralloc *sa, const char *str)
int stralloc_copy(stralloc *sa, const stralloc *sasce)

int stralloc_insertb(stralloc *sa, size_t offset, const char *data, size_t dlen)
int stralloc_inserts(stralloc *sa, size_t offset, const char *str)
int stralloc_inserts0(stralloc *sa, size_t offset, const char *str)
int stralloc_insert(stralloc *sa, size_t offset, const stralloc *sasce)

int stralloc_append(stralloc *sa, char c)
int stralloc_0(stralloc *sa)

DESCRIPTION

The stralloc_catb() function appends the content of memory pointed by data of length dlen into the stralloc sa.

The stralloc_cats() function is similar to stralloc_catb() but appending the NUL-terminated string pointed by str, not including said NUL-terminating byte.

The stralloc_cats0() function is similar to stralloc_cats() but including the NUL-terminating byte.

The stralloc_catv() function is similar to stralloc_catb() but gathering the data to add from the array of vectors v of n elements.

The stralloc_cat() function is similar to stralloc_catb() function but appending the content of stralloc sasce.

The stralloc_copyb() function copies the content of memory pointed by data of length dlen into the stralloc sa. That is, the stralloc will only contain data afterwards.

The stralloc_copys() function is similar to stralloc_copyb() but copying the NUL-terminated string pointed by str, not including said NUL-terminating byte.

The stralloc_copys0() function is similar to stralloc_copys() but including the NUL-terminating byte.

The stralloc_copy() function is similar to stralloc_copyb() function but copying the content of stralloc sasce.

The stralloc_insertb() function inserts the content of memory pointed by data of length dlen into the stralloc sa at offset offset.

The stralloc_inserts() function is similar to stralloc_insertb() but inserting the NUL-terminated string pointed by str, not including said NUL-terminating byte.

The stralloc_inserts0() function is similar to stralloc_inserts() but including the NUL-terminating byte.

The stralloc_insert() function is similar to stralloc_insertb() function but inserting the content of stralloc sasce.

The stralloc_append() function appends byte c into the stralloc sa.

The stralloc_0() function appends a NUL-byte into stralloc sa.

Note

Obviously all these function ensure that there is enough room available in the stralloc sa before writing data into it.

RETURN VALUE

These functions return 1 on success. Otherwise they return 0 and set errno to indicate the error.

ERRORS

These functions may fail if :

ENOMEM

Out of memory.

The stralloc_insertb(), stralloc_inserts(), stralloc_inserts0() and stralloc_insert() functions may also fail if :

EINVAL

The offset is too high.

limb 0.1.0
2023-07-24
stralloc_cat(3)