X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstring%2Fmemchr.c;h=6a6440a80e3a6010937ee22402d3d289802879fe;hb=e5456e3c2697c4e17fc9aa3439f2e305517b4d96;hp=83d6f1702c5fd3fc190d9082c4f577892ea604dc;hpb=dcc8a8e99f69e090a03b7b868443addbc0817820;p=pdclib.old diff --git a/functions/string/memchr.c b/functions/string/memchr.c index 83d6f17..6a6440a 100644 --- a/functions/string/memchr.c +++ b/functions/string/memchr.c @@ -15,3 +15,19 @@ void * memchr( void * s, int c, size_t n ) { /* TODO */ }; // Standard C void * memchr( const void * s, int c, size_t n ) { /* TODO */ }; + +/* PDPC code - unreviewed +{ + const unsigned char *p; + size_t x = 0; + + p = (const unsigned char *)s; + while (x < n) + { + if (*p == (unsigned char)c) return ((void *)p); + p++; + x++; + } + return (NULL); +} +*/