From 047bfc47c6d9cd3c7d4035c02fdd1059077eb60c Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Mon, 27 Dec 2021 20:50:06 +0100 Subject: [PATCH 1/2] Remove HAVE_MEMCPY ifdefs memcpy(3) has been in standard C since C89. It is also in POSIX.1-2001, in SVr4, and in 4.3BSD (see memcpy(3) and memcpy(3p)). We can assume that this function is always available. Signed-off-by: Alejandro Colomar --- configure.ac | 2 +- lib/defines.h | 4 ---- libmisc/getdate.y | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index a94e897f..fbdcc17e 100644 --- a/configure.ac +++ b/configure.ac @@ -53,7 +53,7 @@ AC_CHECK_HEADER([shadow.h],,[AC_MSG_ERROR([You need a libc with shadow.h])]) AC_CHECK_FUNCS(arc4random_buf l64a fchmod fchown fsync futimes getgroups \ gethostname getentropy getrandom getspnam gettimeofday getusershell \ - getutent initgroups lchown lckpwdf lstat lutimes memcpy memset \ + getutent initgroups lchown lckpwdf lstat lutimes memset \ setgroups sigaction strchr updwtmp updwtmpx innetgr getpwnam_r \ getpwuid_r getgrnam_r getgrgid_r getspnam_r getaddrinfo ruserok \ dlopen) diff --git a/lib/defines.h b/lib/defines.h index e1500a76..5153f43c 100644 --- a/lib/defines.h +++ b/lib/defines.h @@ -70,10 +70,6 @@ extern char * textdomain (const char * domainname); # define strrchr rindex # endif char *strchr (), *strrchr (), *strtok (); - -# ifndef HAVE_MEMCPY -# define memcpy(d, s, n) bcopy((s), (d), (n)) -# endif #endif /* not STDC_HEADERS */ #if HAVE_ERRNO_H diff --git a/libmisc/getdate.y b/libmisc/getdate.y index 5a8bde2e..7afa995b 100644 --- a/libmisc/getdate.y +++ b/libmisc/getdate.y @@ -61,7 +61,7 @@ /* Some old versions of bison generate parsers that use bcopy. That loses on systems that don't provide the function, so we have to redefine it here. */ -#if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy) +#if !defined (HAVE_BCOPY) && !defined (bcopy) # define bcopy(from, to, len) memcpy ((to), (from), (len)) #endif From b7e12ec04e82c4ce88b18928adff5ff992bd715c Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Mon, 27 Dec 2021 20:50:06 +0100 Subject: [PATCH 2/2] Remove HAVE_MEMSET ifdefs memset(3) has been in standard C since C89. It is also in POSIX.1-2001, in SVr4, and in 4.3BSD (see memset(3) and memset(3p)). We can assume that this function is always available. Signed-off-by: Alejandro Colomar --- configure.ac | 2 +- lib/defines.h | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index fbdcc17e..9c1a589f 100644 --- a/configure.ac +++ b/configure.ac @@ -53,7 +53,7 @@ AC_CHECK_HEADER([shadow.h],,[AC_MSG_ERROR([You need a libc with shadow.h])]) AC_CHECK_FUNCS(arc4random_buf l64a fchmod fchown fsync futimes getgroups \ gethostname getentropy getrandom getspnam gettimeofday getusershell \ - getutent initgroups lchown lckpwdf lstat lutimes memset \ + getutent initgroups lchown lckpwdf lstat lutimes \ setgroups sigaction strchr updwtmp updwtmpx innetgr getpwnam_r \ getpwuid_r getgrnam_r getgrgid_r getspnam_r getaddrinfo ruserok \ dlopen) diff --git a/lib/defines.h b/lib/defines.h index 5153f43c..fc1521cb 100644 --- a/lib/defines.h +++ b/lib/defines.h @@ -111,11 +111,7 @@ char *strchr (), *strrchr (), *strtok (); # endif #endif /* not TIME_WITH_SYS_TIME */ -#ifdef HAVE_MEMSET -# define memzero(ptr, size) memset((void *)(ptr), 0, (size)) -#else -# define memzero(ptr, size) bzero((char *)(ptr), (size)) -#endif +#define memzero(ptr, size) memset((void *)(ptr), 0, (size)) #define strzero(s) memzero(s, strlen(s)) /* warning: evaluates twice */ #ifdef HAVE_DIRENT_H /* DIR_SYSV */