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

#include <sys/types.h>
#include <string.h>
#include <skalibs/bytestr.h>

size_t byte_chr (char const *s, size_t n, int c)
{
  register void *p = memchr(s, c, n) ;
  return p ? (char *)p - s : n ;
}