summaryrefslogtreecommitdiff
path: root/src/libstddjb/stralloc_catv.c
blob: a0c50aa212462fdc8ca8c438103e6bb84f9336c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* ISC license. */

#include <sys/types.h>
#include <string.h>
#include <sys/uio.h>
#include <skalibs/siovec.h>
#include <skalibs/stralloc.h>

int stralloc_catv (stralloc *sa, struct iovec const *v, unsigned int n)
{
  unsigned int i = 0 ;
  if (!stralloc_readyplus(sa, siovec_len(v, n))) return 0 ;
  for ( ; i < n ; i++)
  {
    memmove(sa->s + sa->len, v[i].iov_base, v[i].iov_len) ;
    sa->len += v[i].iov_len ;
  }
  return 1 ;
}