~ubuntu-branches/ubuntu/saucy/renameutils/saucy

« back to all changes in this revision

Viewing changes to lib/memmove.c

  • Committer: Package Import Robot
  • Author(s): Francois Marier
  • Date: 2012-05-06 21:45:54 UTC
  • mfrom: (10.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20120506214554-k531n9odfuwk2451
Tags: 0.12.0-1
* New upstream release (closes: #600411)
* Patch to fix typo in installation target of Makefile

* Bump Standards-Version up to 3.9.3
* Bump debhelper compatibility to 9
* Switch to a minimal debian/rules file

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
#include <config.h>
7
 
 
8
 
#include <stddef.h>
9
 
 
10
 
void *
11
 
memmove (void *dest0, void const *source0, size_t length)
12
 
{
13
 
  char *dest = dest0;
14
 
  char const *source = source0;
15
 
  if (source < dest)
16
 
    /* Moving from low mem to hi mem; start at end.  */
17
 
    for (source += length, dest += length; length; --length)
18
 
      *--dest = *--source;
19
 
  else if (source != dest)
20
 
    {
21
 
      /* Moving from hi mem to low mem; start at beginning.  */
22
 
      for (; length; --length)
23
 
        *dest++ = *source++;
24
 
    }
25
 
  return dest0;
26
 
}