Make source const.
[gnulib.git] / lib / memmove.c
1 /* memmove.c -- copy memory.
2    Copy LENGTH bytes from SOURCE to DEST.  Does not null-terminate.
3    In the public domain.
4    By David MacKenzie <djm@gnu.ai.mit.edu>.  */
5
6 void
7 memmove (dest, source, length)
8      char *dest;
9      const char *source;
10      unsigned length;
11 {
12   if (source < dest)
13     /* Moving from low mem to hi mem; start at end.  */
14     for (source += length, dest += length; length; --length)
15       *--dest = *--source;
16   else if (source != dest)
17     /* Moving from hi mem to low mem; start at beginning.  */
18     for (; length; --length)
19       *dest++ = *source++;
20 }