Welcome to little lamb

Code » limb » release » tree

[release] / src / doc / siovec.h / siov_deal.3.md

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

# NAME

siov_deal - copy data from an array of vectors into another

# SYNOPSIS

    #include <limb/siovec.h>

```pre hl
size_t siov_deal(const struct iovec *<em>vdst</em>, unsigned <em>ndst</em>, const struct iovec *<em>vsce</em>, unsigned <em>nsce</em>)
```

# DESCRIPTION

The `siov_deal`() function copies the data from the array `vsce` of `nsce`
vectors into the memory pointed by the array `vdst` of `ndst` vectors.

You can think of it as a [memcpy](3) for vectors.

It is similar to [siov_scatter](3) only copying data from another array of
vectors instead of a byte array.

! NOTE:
! The function only copies data from one location in memory to another, as
! described by the two array of vectors. The arrays themselves are /not/
! modified, which means that if the `vdst` array represents a larger space than
! `vsce` does, the content of the data in `vdst` after the length of data
! copied (from `vsce`) is left unchanged, as is the array itself.
!
! In other words, the length of data in `vdst` (i.e. as returned by
! `siov_len(vdst, ndst)`) does not change upon calling this function, regardless
! of how much data is actually copied.

# RETURN VALUE

The `siov_deal`() function returns the amount of data copied, which may be less
than what `siov_len(vsce, nsce)` would return, if there wasn't enough space in
the memory represented by the `vdst` array of `ndst` vectors, or less than what
`siov_len(vdst, ndst)` would return, as noted above.

# SEE ALSO

[siov_scatter](3), [siov_gather](3)