xref: /netbsd-src/external/gpl3/gdb/dist/libiberty/mempcpy.c (revision 7e120ff03ede3fe64e2c8620c01465d528502ddb)
198b9484cSchristos /* Implement the mempcpy function.
2*7e120ff0Schristos    Copyright (C) 2003-2024 Free Software Foundation, Inc.
398b9484cSchristos    Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>.
498b9484cSchristos 
598b9484cSchristos This file is part of the libiberty library.
698b9484cSchristos Libiberty is free software; you can redistribute it and/or
798b9484cSchristos modify it under the terms of the GNU Library General Public
898b9484cSchristos License as published by the Free Software Foundation; either
998b9484cSchristos version 2 of the License, or (at your option) any later version.
1098b9484cSchristos 
1198b9484cSchristos Libiberty is distributed in the hope that it will be useful,
1298b9484cSchristos but WITHOUT ANY WARRANTY; without even the implied warranty of
1398b9484cSchristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1498b9484cSchristos Library General Public License for more details.
1598b9484cSchristos 
1698b9484cSchristos You should have received a copy of the GNU Library General Public
1798b9484cSchristos License along with libiberty; see the file COPYING.LIB.  If
1898b9484cSchristos not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
1998b9484cSchristos Boston, MA 02110-1301, USA.  */
2098b9484cSchristos 
2198b9484cSchristos /*
2298b9484cSchristos 
2398b9484cSchristos @deftypefn Supplemental void* mempcpy (void *@var{out}, const void *@var{in}, @
2498b9484cSchristos   size_t @var{length})
2598b9484cSchristos 
2698b9484cSchristos Copies @var{length} bytes from memory region @var{in} to region
2798b9484cSchristos @var{out}.  Returns a pointer to @var{out} + @var{length}.
2898b9484cSchristos 
2998b9484cSchristos @end deftypefn
3098b9484cSchristos 
3198b9484cSchristos */
3298b9484cSchristos 
3398b9484cSchristos #include <ansidecl.h>
3498b9484cSchristos #include <stddef.h>
3598b9484cSchristos 
364b169a6bSchristos extern void *memcpy (void *, const void *, size_t);
3798b9484cSchristos 
384b169a6bSchristos void *
394b169a6bSchristos mempcpy (void *dst, const void *src, size_t len)
4098b9484cSchristos {
4198b9484cSchristos   return (char *) memcpy (dst, src, len) + len;
4298b9484cSchristos }
43