skalibs

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

byte_chr.c (213B)


      1 /* ISC license. */
      2 
      3 #include <string.h>
      4 #include <skalibs/bytestr.h>
      5 
      6 size_t byte_chr (char const *s, size_t n, int c)
      7 {
      8   void *p ;
      9   if (!n) return 0 ;
     10   p = memchr(s, c, n) ;
     11   return p ? (char *)p - s : n ;
     12 }