Remove some unused or hard-coded header checks.

Remove some unused checks and code found using

grep -o 'HAVE_[A-Z0-9_]*' ConfigureChecks.cmake | sort -u \
| while read have_h ; do echo = $have_h ; git --no-pager grep -cl $have_h ; done

Change-Id: I86bfcfdc4f60d9d7de87017a7bb00f833a79bd2c
Reviewed-on: https://code.wireshark.org/review/26451
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Gerald Combs 2018-03-12 12:22:20 -07:00
parent 1a52e085c1
commit 2519115695
7 changed files with 3 additions and 140 deletions

View File

@ -12,23 +12,14 @@ include(CMakePushCheckState)
#check system for includes
include(CheckIncludeFile)
check_include_file("arpa/inet.h" HAVE_ARPA_INET_H)
check_include_file("arpa/nameser.h" HAVE_ARPA_NAMESER_H)
check_include_file("dlfcn.h" HAVE_DLFCN_H)
check_include_file("fcntl.h" HAVE_FCNTL_H)
check_include_file("getopt.h" HAVE_GETOPT_H)
check_include_file("grp.h" HAVE_GRP_H)
check_include_file("ifaddrs.h" HAVE_IFADDRS_H)
check_include_file("netinet/in.h" HAVE_NETINET_IN_H)
check_include_file("netdb.h" HAVE_NETDB_H)
# We need to set the path to Wpdpack in order to find Ntddndis.h
#cmake_push_check_state()
#set(CMAKE_REQUIRED_INCLUDES ${PCAP_INCLUDE_DIRS})
#check_include_file("Ntddndis.h" HAVE_NTDDNDIS_H)
#cmake_pop_check_state()
check_include_file("portaudio.h" HAVE_PORTAUDIO_H)
check_include_file("pwd.h" HAVE_PWD_H)
check_include_file("sys/ioctl.h" HAVE_SYS_IOCTL_H)
check_include_file("sys/param.h" HAVE_SYS_PARAM_H)
check_include_file("sys/select.h" HAVE_SYS_SELECT_H)
check_include_file("sys/socket.h" HAVE_SYS_SOCKET_H)
check_include_file("sys/sockio.h" HAVE_SYS_SOCKIO_H)
@ -71,7 +62,6 @@ endif()
#Functions
include(CheckFunctionExists)
include(CheckSymbolExists)
check_function_exists("chown" HAVE_CHOWN)
cmake_push_check_state()
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS})
@ -86,7 +76,7 @@ cmake_push_check_state()
set(CMAKE_REQUIRED_INCLUDES ${M_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${M_LIBRARIES})
check_symbol_exists("floorl" "math.h" HAVE_FLOORL)
check_symbol_exists("lrint" "math.h" HAVE_LRINT)
check_symbol_exists("lrint" "math.h" HAVE_LRINT) # GTK+ only
cmake_pop_check_state()
check_function_exists("getopt_long" HAVE_GETOPT_LONG)
@ -99,7 +89,6 @@ if(HAVE_GETOPT_LONG)
endif()
check_function_exists("getifaddrs" HAVE_GETIFADDRS)
check_function_exists("issetugid" HAVE_ISSETUGID)
check_function_exists("mkdtemp" HAVE_MKDTEMP)
check_function_exists("mkstemps" HAVE_MKSTEMPS)
check_function_exists("popcount" HAVE_POPCOUNT)
check_function_exists("setresgid" HAVE_SETRESGID)

View File

@ -44,9 +44,6 @@
/* Define to 1 if you have the <arpa/inet.h> header file. */
#cmakedefine HAVE_ARPA_INET_H 1
/* Define to 1 if you have the <arpa/nameser.h> header file. */
#cmakedefine HAVE_ARPA_NAMESER_H 1
/* Define to 1 if you have the `bpf_image' function. */
#cmakedefine HAVE_BPF_IMAGE 1
@ -56,9 +53,6 @@
/* Define to 1 if you have the `dladdr' function. */
#cmakedefine HAVE_DLADDR 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#cmakedefine HAVE_DLFCN_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#cmakedefine HAVE_FCNTL_H 1
@ -128,9 +122,6 @@
/* Define to use libpcap library */
#cmakedefine HAVE_LIBPCAP 1
/* Define to use libportaudio library */
#cmakedefine HAVE_LIBPORTAUDIO 1
/* Define to 1 if you have the `smi' library (-lsmi). */
#cmakedefine HAVE_LIBSMI 1
@ -161,9 +152,6 @@
/* Define to use MIT kerberos */
#cmakedefine HAVE_MIT_KERBEROS 1
/* Define to 1 if you have the `mkdtemp' function. */
#cmakedefine HAVE_MKDTEMP 1
/* Define to 1 if you have the `mkstemps' function. */
#cmakedefine HAVE_MKSTEMPS 1
@ -191,9 +179,6 @@
/* VHT_CAPABILITY is supported */
#cmakedefine HAVE_NL80211_VHT_CAPABILITY 1
/* Define to 1 if you have the <Ntddndis.h> header file. */
#cmakedefine HAVE_NTDDNDIS_H 1
/* Define to 1 if you have macOS frameworks */
#cmakedefine HAVE_MACOS_FRAMEWORKS 1
@ -261,9 +246,6 @@
/* Define to 1 if you have the popcount function. */
#cmakedefine HAVE_POPCOUNT 1
/* Define to 1 if you have the <portaudio.h> header file. */
#cmakedefine HAVE_PORTAUDIO_H 1
/* Define to 1 if you have the <pwd.h> header file. */
#cmakedefine HAVE_PWD_H 1
@ -309,9 +291,6 @@
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#cmakedefine HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/param.h> header file. */
#cmakedefine HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#cmakedefine HAVE_SYS_SOCKET_H 1
@ -420,9 +399,6 @@
typedef int ssize_t;
# endif
/* FIXME: Detection doesn't work */
# define HAVE_NTDDNDIS_H 1
/*
* Flex (v 2.5.35) uses this symbol to "exclude" unistd.h
*/

View File

@ -2103,7 +2103,7 @@ dnl
AC_CHECK_HEADERS(fcntl.h getopt.h grp.h inttypes.h netdb.h pwd.h unistd.h)
AC_CHECK_HEADERS(sys/ioctl.h sys/param.h sys/select.h sys/socket.h sys/sockio.h sys/stat.h sys/time.h sys/types.h sys/utsname.h sys/wait.h)
AC_CHECK_HEADERS(netinet/in.h)
AC_CHECK_HEADERS(arpa/inet.h arpa/nameser.h)
AC_CHECK_HEADERS(arpa/inet.h)
AC_CHECK_HEADERS(ifaddrs.h)
#
@ -2315,7 +2315,7 @@ fi
AC_REPLACE_FUNCS(strptime)
AC_REPLACE_FUNCS(popcount)
AC_CHECK_FUNCS(mkstemps mkdtemp)
AC_CHECK_FUNCS(mkstemps)
AC_CHECK_FUNCS(issetugid)
AC_CHECK_FUNCS(sysconf)
AC_CHECK_FUNCS(getifaddrs)

View File

@ -41,7 +41,6 @@ libwsutil.so.0 libwsutil0 #MINVER#
create_persconffile_dir@Base 1.12.0~rc1
create_persconffile_profile@Base 1.12.0~rc1
create_profiles_dir@Base 2.5.0
create_tempdir@Base 1.12.0~rc1
create_tempfile@Base 1.12.0~rc1
create_timestamp@Base 2.5.0
crypt_des_ecb@Base 2.3.0

View File

@ -52,9 +52,7 @@
/* issues re winsock.h included before winsock2.h ) */
#include <windowsx.h>
#ifdef HAVE_NTDDNDIS_H
#include <Ntddndis.h>
#endif
#include "caputils/capture_win_ifnames.h"

View File

@ -77,50 +77,6 @@ mkstemps(char *path_template, int suffixlen)
#endif /* HAVE_MKSTEMPS */
#ifndef HAVE_MKDTEMP
/* Generate a unique temporary directory name from TEMPLATE.
The last six characters of TEMPLATE must be TMP_FILE_SUFFIX;
they are replaced with a string that makes the filename unique.
Returns 0 on success or -1 on error (from mkdir(2)). */
char *
mkdtemp (char *path_template)
{
static const char letters[]
= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
size_t len;
size_t i;
len = strlen (path_template);
if (len < 6 || strcmp (&path_template[len - 6], TMP_FILE_SUFFIX))
{
__set_errno (EINVAL);
return NULL;
}
if (g_snprintf (&path_template[len - 5], 6, "%.5u",
(unsigned int) ws_getpid () % 100000) != 5)
/* Inconceivable lossage. */
return NULL;
for (i = 0; i < sizeof (letters); ++i)
{
int ret;
path_template[len - 6] = letters[i];
ret = ws_mkdir(path_template, 0700);
if (ret >= 0)
return path_template;
}
/* We return the null string if we can't find a unique file name. */
path_template[0] = '\0';
return NULL;
}
#endif /* HAVE_MKDTEMP */
/*
* Construct and return the path name of a file in the
* appropriate temporary file directory.
@ -220,49 +176,6 @@ create_tempfile(char **namebuf, const char *pfx, const char *sfx)
return fd;
}
/**
* Create a directory with the given prefix (e.g. "wireshark"). The path
* is created using g_get_tmp_dir and mkdtemp.
*
* @param namebuf
* @param pfx A prefix for the temporary directory.
* @return The temporary directory path on success, or NULL on failure.
* Must NOT be freed.
*/
const char *
create_tempdir(char **namebuf, const char *pfx)
{
static char *td_path[3];
static int td_path_len[3];
static int idx;
const char *tmp_dir;
idx = (idx + 1) % 3;
/*
* Allocate the buffer if it's not already allocated.
*/
if (td_path[idx] == NULL) {
td_path_len[idx] = INITIAL_PATH_SIZE;
td_path[idx] = (char *)g_malloc(td_path_len[idx]);
}
/*
* We can't use get_tempfile_path here because we're called from dumpcap.c.
*/
tmp_dir = g_get_tmp_dir();
while (g_snprintf(td_path[idx], td_path_len[idx], "%s%c%s" TMP_FILE_SUFFIX, tmp_dir, G_DIR_SEPARATOR, pfx) > td_path_len[idx]) {
td_path_len[idx] *= 2;
td_path[idx] = (char *)g_realloc(td_path[idx], td_path_len[idx]);
}
if (namebuf) {
*namebuf = td_path[idx];
}
return mkdtemp(td_path[idx]);
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*

View File

@ -44,18 +44,6 @@ WS_DLL_PUBLIC char *get_tempfile_path(const char *filename);
*/
WS_DLL_PUBLIC int create_tempfile(char **namebuf, const char *pfx, const char *sfx);
/**
* Create a directory with the given prefix (e.g. "wireshark"). The path
* is created using g_get_tmp_dir and mkdtemp.
*
* @param namebuf If not NULL, receives the full path of the temp directory.
* Must NOT be freed.
* @param pfx A prefix for the temporary directory.
* @return The temporary directory path on success, or NULL on failure.
* Must NOT be freed.
*/
WS_DLL_PUBLIC const char *create_tempdir(char **namebuf, const char *pfx);
#ifdef __cplusplus
}
#endif /* __cplusplus */