X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstring%2Fmemchr.c;h=6a6440a80e3a6010937ee22402d3d289802879fe;hp=83d6f1702c5fd3fc190d9082c4f577892ea604dc;hb=0a5395faab237ba9008352b0f4bee9659bbd3d5f;hpb=34893ecc2200dc7017c36a54cb6c5f4c2378b5ec 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); +} +*/