]> granicus.if.org Git - vim/commitdiff
patch 8.0.0241: fallback implementation of mch_memmove is unused v8.0.0241
authorBram Moolenaar <Bram@vim.org>
Thu, 26 Jan 2017 20:36:34 +0000 (21:36 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 26 Jan 2017 20:36:34 +0000 (21:36 +0100)
Problem:    Vim defines a mch_memmove() function but it doesn't work, thus is
            always unused.
Solution:   Remove the mch_memmove implementation. (suggested by Dominique
            Pelle)

src/misc2.c
src/os_unix.h
src/version.c
src/vim.h

index 26d5970f9a34cd00e46a8a1401a1543dec163487..dd0e694643770533f14a7f548e9c43b12ba14e32 100644 (file)
@@ -1740,34 +1740,6 @@ vim_memset(void *ptr, int c, size_t size)
 }
 #endif
 
-/* skipped when generating prototypes, the prototype is in vim.h */
-#ifdef VIM_MEMMOVE
-/*
- * Version of memmove() that handles overlapping source and destination.
- * For systems that don't have a function that is guaranteed to do that (SYSV).
- */
-    void
-mch_memmove(void *src_arg, void *dst_arg, size_t len)
-{
-    /*
-     * A void doesn't have a size, we use char pointers.
-     */
-    char *dst = dst_arg, *src = src_arg;
-
-                                       /* overlap, copy backwards */
-    if (dst > src && dst < src + len)
-    {
-       src += len;
-       dst += len;
-       while (len-- > 0)
-           *--dst = *--src;
-    }
-    else                               /* copy forwards */
-       while (len-- > 0)
-           *dst++ = *src++;
-}
-#endif
-
 #if (!defined(HAVE_STRCASECMP) && !defined(HAVE_STRICMP)) || defined(PROTO)
 /*
  * Compare two strings, ignoring case, using current locale.
index d28aa4dde4542aac141182a624d15d9476f20042..695affaea93e542ddd904bfcd741f6bdd8b5fdf5 100644 (file)
@@ -423,21 +423,17 @@ typedef struct dsc$descriptor   DESC;
 # endif
 #endif
 
-/* memmove is not present on all systems, use memmove, bcopy, memcpy or our
- * own version */
-/* Some systems have (void *) arguments, some (char *). If we use (char *) it
+/* memmove() is not present on all systems, use memmove, bcopy or memcpy.
+ * Some systems have (void *) arguments, some (char *). If we use (char *) it
  * works for all */
-#ifdef USEMEMMOVE
+#if defined(USEMEMMOVE) || (!defined(USEBCOPY) && !defined(USEMEMCPY))
 # define mch_memmove(to, from, len) memmove((char *)(to), (char *)(from), len)
 #else
 # ifdef USEBCOPY
 #  define mch_memmove(to, from, len) bcopy((char *)(from), (char *)(to), len)
 # else
-#  ifdef USEMEMCPY
+    /* ifdef USEMEMCPY */
 #   define mch_memmove(to, from, len) memcpy((char *)(to), (char *)(from), len)
-#  else
-#   define VIM_MEMMOVE     /* found in misc2.c */
-#  endif
 # endif
 #endif
 
index 4e416171944ec4107116d9e8d433493af7e47d3c..08b5dec6829618af4b86ca4e465f430ff1788413 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    241,
 /**/
     240,
 /**/
index 4ebf348044eee7b8ac727774dcfd5bd5e13df501..1bd38219a3815005c5db7c7e24e1dcb99fe945df 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -1714,15 +1714,8 @@ typedef unsigned short disptick_T;       /* display tick type */
 
 typedef void       *vim_acl_T;         /* dummy to pass an ACL to a function */
 
-/*
- * Include a prototype for mch_memmove(), it may not be in alloc.pro.
- */
-#ifdef VIM_MEMMOVE
-void mch_memmove(void *, void *, size_t);
-#else
-# ifndef mch_memmove
-#  define mch_memmove(to, from, len) memmove(to, from, len)
-# endif
+#ifndef mch_memmove
+# define mch_memmove(to, from, len) memmove((char*)(to), (char*)(from), (char*)(len))
 #endif
 
 /*