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

#include <skalibs/bytestr.h>

size_t byte_rchr (char const *s, size_t n, int c)
{
  size_t i = n ;
  char ch = c ;
  s += n ;
  while (i--) if (*--s == ch) return i ;
  return n ;
}