stralloc_catv.c (413B)
1 /* ISC license. */ 2 3 #include <string.h> 4 #include <sys/uio.h> 5 #include <skalibs/siovec.h> 6 #include <skalibs/stralloc.h> 7 8 int stralloc_catv (stralloc *sa, struct iovec const *v, unsigned int n) 9 { 10 unsigned int i = 0 ; 11 if (!stralloc_readyplus(sa, siovec_len(v, n))) return 0 ; 12 for ( ; i < n ; i++) 13 { 14 memmove(sa->s + sa->len, v[i].iov_base, v[i].iov_len) ; 15 sa->len += v[i].iov_len ; 16 } 17 return 1 ; 18 }