To: vim_dev@googlegroups.com Subject: Patch 8.0.0241 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0241 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) Files: src/os_unix.h, src/misc2.c, src/vim.h *** ../vim-8.0.0240/src/os_unix.h 2016-11-04 20:35:27.352945991 +0100 --- src/os_unix.h 2017-01-26 21:32:19.412337932 +0100 *************** *** 423,443 **** # 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 * works for all */ ! #ifdef USEMEMMOVE # 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 # define mch_memmove(to, from, len) memcpy((char *)(to), (char *)(from), len) - # else - # define VIM_MEMMOVE /* found in misc2.c */ - # endif # endif #endif --- 423,439 ---- # endif #endif ! /* 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 */ ! #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 */ # define mch_memmove(to, from, len) memcpy((char *)(to), (char *)(from), len) # endif #endif *** ../vim-8.0.0240/src/misc2.c 2017-01-22 15:05:08.107998905 +0100 --- src/misc2.c 2017-01-26 21:32:40.032205619 +0100 *************** *** 1740,1773 **** } #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. --- 1740,1745 ---- *** ../vim-8.0.0240/src/vim.h 2017-01-21 20:04:17.570757762 +0100 --- src/vim.h 2017-01-26 21:33:57.643707606 +0100 *************** *** 1714,1728 **** 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 #endif /* --- 1714,1721 ---- typedef void *vim_acl_T; /* dummy to pass an ACL to a function */ ! #ifndef mch_memmove ! # define mch_memmove(to, from, len) memmove((char*)(to), (char*)(from), (char*)(len)) #endif /* *** ../vim-8.0.0240/src/version.c 2017-01-26 21:23:44.583641679 +0100 --- src/version.c 2017-01-26 21:34:25.679527711 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 241, /**/ -- I'm sure that I asked CBuilder to do a "full" install. Looks like I got a "fool" install, instead. Charles E Campbell, Jr, PhD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///