Welcome to little lamb

Code » limb » release » tree

[release] / src / doc / genalloc.h / genalloc_cat.3.md

% limb manual
% genalloc_cat(3)
% limb 0.1.0
% 2023-07-24

# NAME

genalloc_catb, genalloc_cat, genalloc_copyb, genalloc_copy, genalloc_insertb,
genalloc_insert, genalloc_append - adding data into a genalloc

# SYNOPSIS

    #include <limb/genalloc.h>

```pre hl
int genalloc_catb(<em>type</em>, genalloc *<em>ga</em>, const <em>type</em> *<em>el</em>, int <em>num</em>)
int genalloc_cat(<em>type</em>, genalloc *<em>ga</em>, const genalloc *<em>gasce</em>)

int genalloc_copyb(<em>type</em>, genalloc *<em>ga</em>, const <em>type</em> *<em>el</em>, int <em>num</em>)
int genalloc_copy(<em>type</em>, genalloc *<em>ga</em>, const genalloc *<em>gasce</em>)

int genalloc_insertb(<em>type</em>, genalloc *<em>ga</em>, size_t <em>offset</em>, const <em>type</em> *<em>el</em>, int <em>num</em>)
int genalloc_insert(<em>type</em>, genalloc *<em>ga</em>, size_t <em>offset</em>, const genalloc *<em>gasce</em>)

int genalloc_append(<em>type</em>, genalloc *<em>ga</em>, type *<em>el</em>)
```

# DESCRIPTION

The `genalloc_catb`() macro appends the content of memory pointed by `el` -
which must be `num` elements of type `type` - into the genalloc pointed by `ga`.

The `genalloc_cat`() macro is similar to `genalloc_catb`() macro but
appending the content of genalloc `gasce`.


The `genalloc_copyb`() macro copies the content of memory pointed by `el` -
which must be `num` elements of type `type` - into the genalloc pointed by `ga`.
That is, the genalloc will only contain `el` afterwards.

The `genalloc_copy`() macro is similar to `genalloc_copyb`() macro but
copying the content of genalloc `gasce`.


The `genalloc_insertb`() macro inserts the content of memory pointed by
`el` - which must be `num` elements of type `type` -  into the genalloc pointed
by `ga` at offset `offset`.

The `genalloc_insert`() macro is similar to `genalloc_insertb`() macro but
inserting the content of genalloc `gasce`.


The `genalloc_append`() macro appends the element of type `type` pointed be
`el` into the genalloc pointed by `ga`.

! NOTE:
! Obviously all these macros ensure that there is enough room available in the
! genalloc `ga` 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

The `genalloc_catb`(), `genalloc_cat`(), `genalloc_copyb`(), `genalloc_copy`(),
`genalloc_insertb`() and `genalloc_insert`() functions may fail for the errors
described for [stralloc_catb](3), [stralloc_cat](3), [stralloc_copyb](3),
[stralloc_copy](3), [stralloc_insertb](3) and [stralloc_insert](3) respectively.

The `genalloc_append`() function may fail for the error described for
[stralloc_catb](3).