From 682c5ae66dccbce8336fd0e0d3dc40f087644ca6 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sun, 8 Oct 2017 17:11:19 +0200 Subject: [PATCH] Remove unused/obsolete checks from configure.ac and unused functions from dropin.c. --- configure.ac | 15 ++------------- src/dropin.c | 34 ---------------------------------- src/dropin.h | 4 ---- src/have.h | 11 +++-------- src/system.h | 6 ------ 5 files changed, 5 insertions(+), 65 deletions(-) diff --git a/configure.ac b/configure.ac index d2d7c8c7..f62eff73 100644 --- a/configure.ac +++ b/configure.ac @@ -95,20 +95,9 @@ AM_CONDITIONAL(INSTALL_TESTS, test "$install_tests" = true) dnl Checks for header files. dnl We do this in multiple stages, because unlike Linux all the other operating systems really suck and don't include their own dependencies. -AC_HEADER_STDC -AC_CHECK_HEADERS([stdbool.h syslog.h sys/file.h sys/param.h sys/resource.h sys/socket.h sys/time.h sys/un.h sys/wait.h netdb.h arpa/inet.h dirent.h]) -AC_CHECK_HEADERS([time.h], - [], [], [#include "src/have.h"] -) +AC_CHECK_HEADERS([syslog.h sys/file.h sys/param.h sys/resource.h sys/socket.h sys/time.h sys/un.h sys/wait.h netdb.h arpa/inet.h dirent.h]) dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_C_VOLATILE -AC_TYPE_PID_T -AC_TYPE_SIZE_T -AC_HEADER_TIME -AC_STRUCT_TM - MeshLink_ATTRIBUTE(__malloc__) MeshLink_ATTRIBUTE(__warn_unused_result__) @@ -122,7 +111,7 @@ AC_CHECK_TYPES([struct sockaddr_storage], ,AC_MSG_ERROR([System must support str dnl Checks for library functions. AC_TYPE_SIGNAL -AC_CHECK_FUNCS([asprintf fchmod fork get_current_dir_name gettimeofday random select strdup strerror time usleep], +AC_CHECK_FUNCS([asprintf fchmod fork gettimeofday random select strdup usleep], [], [], [#include "src/have.h"] ) diff --git a/src/dropin.c b/src/dropin.c index 9fbd6b9e..ff3e8c02 100644 --- a/src/dropin.c +++ b/src/dropin.c @@ -21,40 +21,6 @@ #include "xalloc.h" -#ifndef HAVE_GET_CURRENT_DIR_NAME -/* - Replacement for the GNU get_current_dir_name function: - - get_current_dir_name will malloc(3) an array big enough to hold the - current directory name. If the environment variable PWD is set, and - its value is correct, then that value will be returned. -*/ -char *get_current_dir_name(void) { - size_t size; - char *buf; - char *r; - - /* Start with 100 bytes. If this turns out to be insufficient to - contain the working directory, double the size. */ - size = 100; - buf = xmalloc(size); - - errno = 0; /* Success */ - r = getcwd(buf, size); - - /* getcwd returns NULL and sets errno to ERANGE if the bufferspace - is insufficient to contain the entire working directory. */ - while(r == NULL && errno == ERANGE) { - free(buf); - size <<= 1; /* double the size */ - buf = xmalloc(size); - r = getcwd(buf, size); - } - - return buf; -} -#endif - #ifndef HAVE_ASPRINTF int asprintf(char **buf, const char *fmt, ...) { int result; diff --git a/src/dropin.h b/src/dropin.h index a85f8110..fe2b8589 100644 --- a/src/dropin.h +++ b/src/dropin.h @@ -23,10 +23,6 @@ #include "fake-getaddrinfo.h" #include "fake-getnameinfo.h" -#ifndef HAVE_GET_CURRENT_DIR_NAME -extern char *get_current_dir_name(void); -#endif - #ifndef HAVE_ASPRINTF extern int asprintf(char **, const char *, ...); extern int vasprintf(char **, const char *, va_list ap); diff --git a/src/have.h b/src/have.h index 7695adc1..536226d5 100644 --- a/src/have.h +++ b/src/have.h @@ -32,6 +32,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -47,18 +50,10 @@ #include #endif -#ifdef HAVE_STDBOOL_H -#include -#endif - #ifdef HAVE_TERMIOS_H #include #endif -#ifdef HAVE_INTTYPES_H -#include -#endif - /* Include system specific headers */ #ifdef HAVE_SYSLOG_H diff --git a/src/system.h b/src/system.h index 2c095515..dc392874 100644 --- a/src/system.h +++ b/src/system.h @@ -24,12 +24,6 @@ #include "have.h" -#ifndef HAVE_STDBOOL_H -typedef int bool; -#define true 1 -#define false 0 -#endif - #ifndef HAVE_STRSIGNAL # define strsignal(p) "" #endif -- 2.39.5