Back to index

tetex-bin  3.0
memcpy.c
Go to the documentation of this file.
00001 /* Copyright (C) 1995, 1997, 2000, 2003 Free Software Foundation, Inc.
00002 
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; either version 2, or (at your option)
00006    any later version.
00007 
00008    This program is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011    GNU General Public License for more details.
00012 
00013    You should have received a copy of the GNU General Public License
00014    along with this program; if not, write to the Free Software Foundation,
00015    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
00016 
00017 /* Written by Jim Meyering <meyering@na-net.ornl.gov>.  */
00018 
00019 #if HAVE_CONFIG_H
00020 # include <config.h>
00021 #endif
00022 
00023 #include <stddef.h>
00024 
00025 /* Copy LEN bytes starting at SRCADDR to DESTADDR.  Result undefined
00026    if the source overlaps with the destination.
00027    Return DESTADDR. */
00028 
00029 void *
00030 memcpy (void *destaddr, void const *srcaddr, size_t len)
00031 {
00032   char *dest = destaddr;
00033   char const *src = srcaddr;
00034 
00035   while (len-- > 0)
00036     *dest++ = *src++;
00037   return destaddr;
00038 }