diff options
author | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-03-26 02:51:44 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-03-26 16:28:13 -0300 |
commit | 07dad7acf3d49b3136c5aad2c9fe05abb9aaf032 (patch) | |
tree | 97ab0057d5c3cf17d2a2e90862c22432dd11c674 /src/misc2.c | |
parent | dbc904956a17e6bec1ddeba9330b639167dbb882 (diff) | |
download | rneovim-07dad7acf3d49b3136c5aad2c9fe05abb9aaf032.tar.gz rneovim-07dad7acf3d49b3136c5aad2c9fe05abb9aaf032.tar.bz2 rneovim-07dad7acf3d49b3136c5aad2c9fe05abb9aaf032.zip |
Use memmove instead of mch_memmove
Diffstat (limited to 'src/misc2.c')
-rw-r--r-- | src/misc2.c | 40 |
1 files changed, 7 insertions, 33 deletions
diff --git a/src/misc2.c b/src/misc2.c index eea138e10d..f36eeb8741 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -1034,7 +1034,7 @@ char_u *vim_strsave(char_u *string) len = (unsigned)STRLEN(string) + 1; p = alloc(len); if (p != NULL) - mch_memmove(p, string, (size_t)len); + memmove(p, string, (size_t)len); return p; } @@ -1098,7 +1098,7 @@ char_u *vim_strsave_escaped_ext(char_u *string, char_u *esc_chars, int cc, int b p2 = escaped_string; for (p = string; *p; p++) { if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) { - mch_memmove(p2, p, (size_t)l); + memmove(p2, p, (size_t)l); p2 += l; p += l - 1; /* skip multibyte char */ continue; @@ -1275,7 +1275,7 @@ char_u *strup_save(char_u *orig) s = alloc((unsigned)STRLEN(res) + 1 + newl - l); if (s == NULL) break; - mch_memmove(s, res, p - res); + memmove(s, res, p - res); STRCPY(s + (p - res) + newl, p + l); p = s + (p - res); vim_free(res); @@ -1352,7 +1352,7 @@ void vim_strcat(char_u *to, char_u *from, size_t tosize) size_t fromlen = STRLEN(from); if (tolen + fromlen + 1 > tosize) { - mch_memmove(to + tolen, from, tosize - tolen - 1); + memmove(to + tolen, from, tosize - tolen - 1); to[tosize - 1] = NUL; } else STRCPY(to + tolen, from); @@ -1430,32 +1430,6 @@ size_t len; } #endif -#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(dst_arg, src_arg, len) -void *src_arg, *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. @@ -1905,9 +1879,9 @@ int (*cmp)(const void *, const void *); if ((*cmp)((void *)p1, (void *)p2) <= 0) break; /* Exchange the elements. */ - mch_memmove(buf, p1, elm_size); - mch_memmove(p1, p2, elm_size); - mch_memmove(p2, buf, elm_size); + memmove(buf, p1, elm_size); + memmove(p1, p2, elm_size); + memmove(p2, buf, elm_size); } vim_free(buf); |