Skip to content

Commit b129a44

Browse files
committed
patch 8.0.0109
Problem: Still checking if memcmp() exists while every system should have it now. Solution: Remove vim_memcmp(). (James McCoy, closes #1295)
1 parent 65e08ee commit b129a44

9 files changed

Lines changed: 7 additions & 44 deletions

File tree

src/config.h.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@
154154
#undef BAD_GETCWD
155155

156156
/* Define if you the function: */
157-
#undef HAVE_BCMP
158157
#undef HAVE_FCHDIR
159158
#undef HAVE_FCHOWN
160159
#undef HAVE_FSEEKO
@@ -170,7 +169,6 @@
170169
#undef HAVE_ICONV
171170
#undef HAVE_NL_LANGINFO_CODESET
172171
#undef HAVE_LSTAT
173-
#undef HAVE_MEMCMP
174172
#undef HAVE_MEMSET
175173
#undef HAVE_MKDTEMP
176174
#undef HAVE_NANOSLEEP

src/configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3594,8 +3594,8 @@ fi
35943594

35953595
dnl Check for functions in one big call, to reduce the size of configure.
35963596
dnl Can only be used for functions that do not require any include.
3597-
AC_CHECK_FUNCS(bcmp fchdir fchown fsync getcwd getpseudotty \
3598-
getpwent getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
3597+
AC_CHECK_FUNCS(fchdir fchown fsync getcwd getpseudotty \
3598+
getpwent getpwnam getpwuid getrlimit gettimeofday getwd lstat \
35993599
memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
36003600
setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
36013601
sigprocmask sigvec strcasecmp strerror strftime stricmp strncasecmp \

src/misc2.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,27 +1740,6 @@ vim_memset(void *ptr, int c, size_t size)
17401740
}
17411741
#endif
17421742

1743-
#ifdef VIM_MEMCMP
1744-
/*
1745-
* Return zero when "b1" and "b2" are the same for "len" bytes.
1746-
* Return non-zero otherwise.
1747-
*/
1748-
int
1749-
vim_memcmp(void *b1, void *b2, size_t len)
1750-
{
1751-
char_u *p1 = (char_u *)b1, *p2 = (char_u *)b2;
1752-
1753-
for ( ; len > 0; --len)
1754-
{
1755-
if (*p1 != *p2)
1756-
return 1;
1757-
++p1;
1758-
++p2;
1759-
}
1760-
return 0;
1761-
}
1762-
#endif
1763-
17641743
/* skipped when generating prototypes, the prototype is in vim.h */
17651744
#ifdef VIM_MEMMOVE
17661745
/*

src/os_vms_conf.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@
101101
#define HAVE_STRTOL
102102
#define HAVE_TGETENT
103103
#define HAVE_MEMSET
104-
#define HAVE_MEMCMP
105104
#define HAVE_STRERROR
106105
#define HAVE_FCHOWN
107106
#define HAVE_RENAME

src/osdef1.h.in

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,7 @@ extern int poll(struct pollfd *, long, int);
5050
#ifdef HAVE_MEMSET
5151
extern void *memset(void *, int, size_t);
5252
#endif
53-
#ifdef HAVE_BCMP
54-
extern int bcmp(void *, void *, size_t);
55-
#endif
56-
#ifdef HAVE_MEMCMP
5753
extern int memcmp(const void *, const void *, size_t);
58-
#endif
5954
#ifdef HAVE_STRPBRK
6055
extern char *strpbrk(const char *, const char *);
6156
#endif

src/search.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1695,7 +1695,8 @@ searchc(cmdarg_T *cap, int t_cmd)
16951695
}
16961696
else
16971697
{
1698-
if (vim_memcmp(p + col, lastc_bytes, lastc_bytelen) == 0 && stop)
1698+
if (memcmp(p + col, lastc_bytes, lastc_bytelen) == 0
1699+
&& stop)
16991700
break;
17001701
}
17011702
stop = TRUE;

src/tag.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2400,7 +2400,7 @@ find_tags(
24002400
mfp2 = ((struct match_found **)
24012401
(ga_match[mtt].ga_data))[i];
24022402
if (mfp2->len == mfp->len
2403-
&& vim_memcmp(mfp2->match, mfp->match,
2403+
&& memcmp(mfp2->match, mfp->match,
24042404
(size_t)mfp->len) == 0)
24052405
break;
24062406
fast_breakcheck();

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
109,
767769
/**/
768770
108,
769771
/**/

src/vim.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,17 +1733,6 @@ void mch_memmove(void *, void *, size_t);
17331733
void *vim_memset(void *, int, size_t);
17341734
#endif
17351735

1736-
#ifdef HAVE_MEMCMP
1737-
# define vim_memcmp(p1, p2, len) memcmp((p1), (p2), (len))
1738-
#else
1739-
# ifdef HAVE_BCMP
1740-
# define vim_memcmp(p1, p2, len) bcmp((p1), (p2), (len))
1741-
# else
1742-
int vim_memcmp(void *, void *, size_t);
1743-
# define VIM_MEMCMP
1744-
# endif
1745-
#endif
1746-
17471736
#if defined(UNIX) || defined(FEAT_GUI) || defined(VMS) \
17481737
|| defined(FEAT_CLIENTSERVER)
17491738
# define USE_INPUT_BUF

0 commit comments

Comments
 (0)