summary refs log tree commit diff
path: root/src/libstddjb/byte_chr.c
blob: ba774aad44c73b0d78c626b698149947fe17b357 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
/* ISC license. */

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

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