• Main Page
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

missing/memmove.c

Go to the documentation of this file.
00001 /* public domain rewrite of memcmp(3) */
00002 
00003 #include <stddef.h>
00004 
00005 void *
00006 memmove(void *d, const void *s, size_t n)
00007 {
00008     char *dst = (char *)d;
00009     const char *src = (const char *)s;
00010 
00011     if (src < dst) {
00012         src += n;
00013         dst += n;
00014         for (; n; --n)
00015             *--dst = *--src;
00016     }
00017     else if (dst < src)
00018         for (; n; --n)
00019             *dst++ = *src++;
00020     return d;
00021 }
00022 

Generated on Wed Sep 8 2010 21:55:01 for Ruby by  doxygen 1.7.1