Use memcmp instead of vim_memcmp

This commit is contained in:
Felipe Oliveira Carvalho 2014-03-26 03:16:09 -03:00 committed by Thiago de Arruda
parent 07dad7acf3
commit bd78282940
4 changed files with 2 additions and 35 deletions

View File

@ -1408,28 +1408,6 @@ void vim_free(void *x)
} }
} }
#ifdef VIM_MEMCMP
/*
* Return zero when "b1" and "b2" are the same for "len" bytes.
* Return non-zero otherwise.
*/
int vim_memcmp(b1, b2, len)
void *b1;
void *b2;
size_t len;
{
char_u *p1 = (char_u *)b1, *p2 = (char_u *)b2;
for (; len > 0; --len) {
if (*p1 != *p2)
return 1;
++p1;
++p2;
}
return 0;
}
#endif
#if (!defined(HAVE_STRCASECMP) && !defined(HAVE_STRICMP)) || defined(PROTO) #if (!defined(HAVE_STRCASECMP) && !defined(HAVE_STRICMP)) || defined(PROTO)
/* /*
* Compare two strings, ignoring case, using current locale. * Compare two strings, ignoring case, using current locale.

View File

@ -1366,7 +1366,7 @@ int searchc(cmdarg_T *cap, int t_cmd)
if (p[col] == c && stop) if (p[col] == c && stop)
break; break;
} else { } else {
if (vim_memcmp(p + col, bytes, bytelen) == 0 && stop) if (memcmp(p + col, bytes, bytelen) == 0 && stop)
break; break;
} }
stop = TRUE; stop = TRUE;

View File

@ -1927,7 +1927,7 @@ parse_line:
mfp2 = ((struct match_found **) mfp2 = ((struct match_found **)
(ga_match[mtt].ga_data))[i]; (ga_match[mtt].ga_data))[i];
if (mfp2->len == mfp->len if (mfp2->len == mfp->len
&& vim_memcmp(mfp2->match, mfp->match, && memcmp(mfp2->match, mfp->match,
(size_t)mfp->len) == 0) (size_t)mfp->len) == 0)
break; break;
line_breakcheck(); line_breakcheck();

View File

@ -1154,17 +1154,6 @@ typedef void *vim_acl_T; /* dummy to pass an ACL to a function */
#define fnamencmp(x, y, n) vim_fnamencmp((char_u *)(x), (char_u *)(y), \ #define fnamencmp(x, y, n) vim_fnamencmp((char_u *)(x), (char_u *)(y), \
(size_t)(n)) (size_t)(n))
#ifdef HAVE_MEMCMP
# define vim_memcmp(p1, p2, len) memcmp((p1), (p2), (len))
#else
# ifdef HAVE_BCMP
# define vim_memcmp(p1, p2, len) bcmp((p1), (p2), (len))
# else
int vim_memcmp(void *, void *, size_t);
# define VIM_MEMCMP
# endif
#endif
#if defined(UNIX) || defined(FEAT_GUI) || defined(OS2) || defined(VMS) \ #if defined(UNIX) || defined(FEAT_GUI) || defined(OS2) || defined(VMS) \
|| defined(FEAT_CLIENTSERVER) || defined(FEAT_CLIENTSERVER)
# define USE_INPUT_BUF # define USE_INPUT_BUF