siovec_bytechr.c (381B)
1 /* ISC license. */ 2 3 #include <sys/uio.h> 4 #include <skalibs/bytestr.h> 5 #include <skalibs/siovec.h> 6 7 size_t siovec_bytechr (struct iovec const *v, unsigned int n, char c) 8 { 9 size_t w = 0 ; 10 unsigned int i = 0 ; 11 for (; i < n ; i++) 12 { 13 size_t pos = byte_chr((char const *)v[i].iov_base, v[i].iov_len, c) ; 14 w += pos ; 15 if (pos < v[i].iov_len) break ; 16 } 17 return w ; 18 }