Browse Source

remove unneeded compat string functions

OPENBSD_5_7
Brent Cook 9 years ago
committed by Brent Cook
parent
commit
46eb3fcad9
4 changed files with 11 additions and 29 deletions
  1. +0
    -8
      Makefile.am
  2. +1
    -3
      configure.ac
  3. +9
    -17
      include/string.h
  4. +1
    -1
      update.sh

+ 0
- 8
Makefile.am View File

@ -61,14 +61,6 @@ if !HAVE_STRLCPY
libcompat_la_SOURCES += compat/strlcpy.c
endif
if !HAVE_STRNDUP
libcompat_la_SOURCES += compat/strndup.c
# the only user of strnlen is strndup, so only build it if needed
if !HAVE_STRNLEN
libcompat_la_SOURCES += compat/strnlen.c
endif
endif
if !HAVE_STRTONUM
libcompat_la_SOURCES += compat/strtonum.c
endif


+ 1
- 3
configure.ac View File

@ -80,7 +80,7 @@ AC_CHECK_FUNCS([arc4random_uniform asprintf explicit_bzero])
AC_CHECK_FUNCS([getentropy memmem poll reallocarray])
AC_CHECK_FUNCS([setproctitle setgroups])
AC_CHECK_FUNCS([setregid setresgid setreuid setresuid])
AC_CHECK_FUNCS([strlcat strlcpy strndup strnlen strtonum])
AC_CHECK_FUNCS([strlcat strlcpy strtonum])
# check auxiliary libraries that might contain other functions
AC_SEARCH_LIBS([arc4random], [crypto])
@ -114,8 +114,6 @@ AM_CONDITIONAL([HAVE_SETPROCTITLE], [test "x$ac_cv_func_setproctitle" = xyes])
AM_CONDITIONAL([HAVE_SHA512], [test "x$ac_cv_func_SHA512Init" = xyes])
AM_CONDITIONAL([HAVE_STRLCAT], [test "x$ac_cv_func_strlcat" = xyes])
AM_CONDITIONAL([HAVE_STRLCPY], [test "x$ac_cv_func_strlcpy" = xyes])
AM_CONDITIONAL([HAVE_STRNDUP], [test "x$ac_cv_func_strndup" = xyes])
AM_CONDITIONAL([HAVE_STRNLEN], [test "x$ac_cv_func_strnlen" = xyes])
AM_CONDITIONAL([HAVE_STRTONUM], [test "x$ac_cv_func_strtonum" = xyes])
# overrides for arc4random_buf implementations with known issues


+ 9
- 17
include/string.h View File

@ -17,24 +17,21 @@
#include <strings.h>
#endif
#ifndef HAVE_STRLCPY
size_t strlcpy(char *dst, const char *src, size_t siz);
#ifndef HAVE_EXPLICIT_BZERO
void explicit_bzero(void *, size_t);
#endif
#ifndef HAVE_STRLCAT
size_t strlcat(char *dst, const char *src, size_t siz);
#ifndef HAVE_MEMMEM
void * memmem(const void *big, size_t big_len, const void *little,
size_t little_len);
#endif
#ifndef HAVE_STRNDUP
char * strndup(const char *str, size_t maxlen);
/* the only user of strnlen is strndup, so only build it if needed */
#ifndef HAVE_STRNLEN
size_t strnlen(const char *str, size_t maxlen);
#endif
#ifndef HAVE_STRLCAT
size_t strlcat(char *dst, const char *src, size_t siz);
#endif
#ifndef HAVE_EXPLICIT_BZERO
void explicit_bzero(void *, size_t);
#ifndef HAVE_STRLCPY
size_t strlcpy(char *dst, const char *src, size_t siz);
#endif
#ifndef HAVE_TIMINGSAFE_BCMP
@ -45,11 +42,6 @@ int timingsafe_bcmp(const void *b1, const void *b2, size_t n);
int timingsafe_memcmp(const void *b1, const void *b2, size_t len);
#endif
#ifndef HAVE_MEMMEM
void * memmem(const void *big, size_t big_len, const void *little,
size_t little_len);
#endif
#ifdef _WIN32
#include <errno.h>


+ 1
- 1
update.sh View File

@ -35,7 +35,7 @@ cp $libutil_src/imsg.c compat/
cp $libutil_src/imsg-buffer.c compat/
(cd compat; $PATCH < $patches/patch-imsg.c)
for i in explicit_bzero.c strlcpy.c strlcat.c strndup.c strnlen.c; do
for i in explicit_bzero.c strlcpy.c strlcat.c; do
$CP $libc_src/string/$i compat
done
$CP $libc_src/stdlib/reallocarray.c compat


Loading…
Cancel
Save