diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2022-11-01 07:43:10 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-11-02 09:03:54 +0100 |
commit | 0673a1d5e43c1360149f11724f277c82adc06d3e (patch) | |
tree | 254b1a9dda19356a676283200b2212039b2e95c5 /lib | |
parent | b6c480f2570f498fe1ccbe0e6017c8989771d3e0 (diff) | |
download | barebox-0673a1d5e43c1360149f11724f277c82adc06d3e.tar.gz |
lib: string: implement mempcpy
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@pengutronix.de>
Link: https://lore.barebox.org/20221101064310.3227410-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/string.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/string.c b/lib/string.c index 6389217d5b..005f4532bb 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 /** |