/* This file is part of limb https://lila.oss/limb
* Copyright (C) 2023 Olivier Brunel jjk@jjacky.com */
/* SPDX-License-Identifier: GPL-2.0-only */
#include <limb/siovec.h>
size_t
siov_gather0(char *dst, size_t dlen, const struct iovec *v, unsigned int n)
{
size_t w = siov_gather(dst, dlen, v, n);
if (dst[w - 1]) {
if (w < dlen)
dst[w++] = 0;
else
dst[w] = 0;
}
return w;
}