On Tue, Nov 01, 2022 at 07:43:10AM +0100, Ahmad Fatoum wrote: > mempcpy(3) is a GNU libc extension that like stpcpy returns not the > start of the destination buffer, but the first byte after its end. > > Provide it as it is useful when concatenating buffers or known-size > strings. > > Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> > --- > v1 -> v2: > - split off function from series using it. Other series needs > commits reordered. Applied, thanks Sascha > --- > include/string.h | 1 + > lib/string.c | 5 +++++ > 2 files changed, 6 insertions(+) > > diff --git a/include/string.h b/include/string.h > index 2cc727fd1d7a..596440ca8164 100644 > --- a/include/string.h > +++ b/include/string.h > @@ -4,6 +4,7 @@ > > #include <linux/string.h> > > +void *mempcpy(void *dest, const void *src, size_t count); > int strtobool(const char *str, int *val); > char *strsep_unescaped(char **, const char *); > char *stpcpy(char *dest, const char *src); > diff --git a/lib/string.c b/lib/string.c > index fd4d7da10a7c..edd36da4d4f2 100644 > --- a/lib/string.c > +++ b/lib/string.c > @@ -603,6 +603,11 @@ void *__memcpy(void * dest, const void *src, size_t count) > __alias(__default_memcpy); > #endif > > +void *mempcpy(void *dest, const void *src, size_t count) > +{ > + return memcpy(dest, src, count) + count; > +} > +EXPORT_SYMBOL(mempcpy); > > #ifndef __HAVE_ARCH_MEMMOVE > /** > -- > 2.30.2 > > > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |