skalibs

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

byte_count.c (175B)


      1 /* ISC license. */
      2 
      3 #include <skalibs/bytestr.h>
      4 
      5 size_t byte_count (char const *s, size_t len, char b)
      6 {
      7   size_t n = 0 ;
      8   while (len--) if (*s++ == b) n++ ;
      9   return n ;
     10 }