lkml.org 
[lkml]   [2019]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [v2] lib/string: add memrchr function
On Wed, Feb 13, 2019 at 3:12 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Wed, Feb 13, 2019 at 02:54:43AM +0800, Xiang Xiao wrote:
> > Here is the detailed description for memrchr:
> >
> > void *memrchr(const void *s, int c, size_t n);
> >
> > The memrchr() function is like the memchr() function, except
> > that it searches backward from the end of the n bytes pointed
> > to by s instead of forward from the beginning.
> >
> > The memrchr() functions return a pointer to the matching byte
> > or NULL if the character does not occur in the given memory
> > area.
> >
> > Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
> > ---
> > include/linux/string.h | 1 +
> > lib/string.c | 21 +++++++++++++++++++++
> > 2 files changed, 22 insertions(+)
> >
> > diff --git a/include/linux/string.h b/include/linux/string.h
> > index 7927b87..f380f4b 100644
> > --- a/include/linux/string.h
> > +++ b/include/linux/string.h
> > @@ -167,6 +167,7 @@ static inline void memcpy_flushcache(void *dst, const void *src, size_t cnt)
> > memcpy(dst, src, cnt);
> > }
> > #endif
> > +void *memrchr(const void *s, int c, size_t n);
> > void *memchr_inv(const void *s, int c, size_t n);
> > char *strreplace(char *s, char old, char new);
>
> Also, if you really need this, why not also provide the arch-specific
> versions as well?
>

Good point, I will make the arch-specific overwrite possible.

> thanks,
>
> greg k-h

\
 
 \ /
  Last update: 2019-02-12 20:20    [W:0.046 / U:1.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site