skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

buffer_getvallnf.c (347B)


      1 /* ISC license. */
      2 
      3 #include <sys/uio.h>
      4 #include <errno.h>
      5 #include <skalibs/siovec.h>
      6 #include <skalibs/buffer.h>
      7 
      8 int buffer_getvallnofill (buffer *b, struct iovec const *v, unsigned int n)
      9 {
     10   size_t r = buffer_getvnofill(b, v, n) ;
     11   if (r < siovec_len(v, n))
     12   {
     13     buffer_unget(b, r) ;
     14     return (errno = ENOBUFS, 0) ;
     15   }
     16   return 1 ;
     17 }