aboutsummaryrefslogtreecommitdiff
path: root/external/unbound/compat/memmove.c
diff options
context:
space:
mode:
Diffstat (limited to 'external/unbound/compat/memmove.c')
m---------external/unbound0
-rw-r--r--external/unbound/compat/memmove.c43
2 files changed, 0 insertions, 43 deletions
diff --git a/external/unbound b/external/unbound
new file mode 160000
+Subproject 193bdc4ee3fe2b0d17e547e86512528c2614483
diff --git a/external/unbound/compat/memmove.c b/external/unbound/compat/memmove.c
deleted file mode 100644
index fe319bb49..000000000
--- a/external/unbound/compat/memmove.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * memmove.c: memmove compat implementation.
- *
- * Copyright (c) 2001-2006, NLnet Labs. All rights reserved.
- *
- * See LICENSE for the license.
-*/
-
-#include <config.h>
-#include <stdlib.h>
-
-void *memmove(void *dest, const void *src, size_t n);
-
-void *memmove(void *dest, const void *src, size_t n)
-{
- uint8_t* from = (uint8_t*) src;
- uint8_t* to = (uint8_t*) dest;
-
- if (from == to || n == 0)
- return dest;
- if (to > from && to-from < (int)n) {
- /* to overlaps with from */
- /* <from......> */
- /* <to........> */
- /* copy in reverse, to avoid overwriting from */
- int i;
- for(i=n-1; i>=0; i--)
- to[i] = from[i];
- return dest;
- }
- if (from > to && from-to < (int)n) {
- /* to overlaps with from */
- /* <from......> */
- /* <to........> */
- /* copy forwards, to avoid overwriting from */
- size_t i;
- for(i=0; i<n; i++)
- to[i] = from[i];
- return dest;
- }
- memcpy(dest, src, n);
- return dest;
-}