aboutsummaryrefslogtreecommitdiffstats
path: root/extcap
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2021-02-14 12:54:42 -0800
committerGuy Harris <gharris@sonic.net>2021-02-14 14:43:42 -0800
commitc0711693ab166b22664a68f01224c4ba682e1207 (patch)
tree136ac536c7ec89f94b337ef9c3ef3f13469e6f03 /extcap
parent3387eef8367ca7b16b5515635f79d971bde97c5e (diff)
Enable -Wredundant-decls.
Add it to the default list of checks, and fix some errors it causes. (Sadly, it doesn't work in CLang.)
Diffstat (limited to 'extcap')
-rw-r--r--extcap/extcap-base.c16
-rw-r--r--extcap/extcap-base.h15
2 files changed, 21 insertions, 10 deletions
diff --git a/extcap/extcap-base.c b/extcap/extcap-base.c
index 68c15ae57d..bc09aa6c54 100644
--- a/extcap/extcap-base.c
+++ b/extcap/extcap-base.c
@@ -19,13 +19,19 @@
#include <string.h>
#include <errno.h>
-#ifdef HAVE_GETOPT_H
- #include <getopt.h>
+/*
+ * If we have getopt_long() in the system library, include <getopt.h>.
+ * Otherwise, we're using our own getopt_long() (either because the
+ * system has getopt() but not getopt_long(), as with some UN*Xes,
+ * or because it doesn't even have getopt(), as with Windows), so
+ * include our getopt_long()'s header.
+ */
+#ifdef HAVE_GETOPT_LONG
+#include <getopt.h>
+#else
+#include <wsutil/wsgetopt.h>
#endif
-#ifndef HAVE_GETOPT_LONG
- #include "wsutil/wsgetopt.h"
-#endif
#include "ws_attributes.h"
enum extcap_options {
diff --git a/extcap/extcap-base.h b/extcap/extcap-base.h
index 11c4431093..20d4be31c3 100644
--- a/extcap/extcap-base.h
+++ b/extcap/extcap-base.h
@@ -19,12 +19,17 @@
#include <stdlib.h>
#include <stdint.h>
-#ifdef HAVE_GETOPT_H
+/*
+ * If we have getopt_long() in the system library, include <getopt.h>.
+ * Otherwise, we're using our own getopt_long() (either because the
+ * system has getopt() but not getopt_long(), as with some UN*Xes,
+ * or because it doesn't even have getopt(), as with Windows), so
+ * include our getopt_long()'s header.
+ */
+#ifdef HAVE_GETOPT_LONG
#include <getopt.h>
-#endif
-
-#ifndef HAVE_GETOPT_LONG
- #include "wsutil/wsgetopt.h"
+#else
+ #include <wsutil/wsgetopt.h>
#endif
#ifdef _WIN32