Welcome to little lamb

Code » limb » master » tree

[master] / src / doc / siovec.h / siov_trunc.3.md

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

# NAME

siov_trunc - truncate an array of vectors

# SYNOPSIS

    #include <limb/siovec.h>

```pre hl
unsigned int siov_trunc(struct iovec *<em>v</em>, unsigned int <em>n</em>, size_t <em>len</em>)
```

# DESCRIPTION

The `siov_trunc`() function updates the array `v` of `n` vectors so that it only
contains `len` bytes of data.

If `len` is larger than the amount of data within the array, nothing happens.
Otherwise, as many vectors (from the end of the array) as needed will be
updated. Only the array is modified, the data itself remains untouched.

# RETURN VALUE

The `siov_trunc`() function return the new number of vectors needed in the
array.
That is, ignoring any vector at the end of the array that doesn't represent any
data (having been zeroed out, or already being empty in the first place) and can
therefore be ignored.

# SEE ALSO

[siov_len](3), [siov_seek](3)