~ubuntu-branches/ubuntu/breezy/gettext/breezy

« back to all changes in this revision

Viewing changes to lib/memmove.c

  • Committer: Bazaar Package Importer
  • Author(s): Santiago Vila
  • Date: 2004-03-14 17:40:02 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040314174002-p1ad5ldve1hqzhye
Tags: 0.14.1-2
* Added libexpat1-dev to Build-Depends, for glade support.
* Added libc0.1-dev to Build-Depends, for GNU/kFreeBSD.
* Removed special-casing of knetbsd-gnu in debian/rules.

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