summaryrefslogtreecommitdiff
path: root/src/libstddjb/byte_count.c
blob: c61f09b5f0832c09c1d1b09185532e4647f0fc4d (plain)
1
2
3
4
5
6
7
8
9
10
/* ISC license. */

#include <skalibs/bytestr.h>

size_t byte_count (char const *s, size_t len, char b)
{
  size_t n = 0 ;
  while (len--) if (*s++ == b) n++ ;
  return n ;
}