]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Fix warnings as "declaration of 'x' shadows a global declaration"
authorFrancois-Xavier Le Bail <[email protected]>
Sun, 12 Jul 2015 19:37:02 +0000 (21:37 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Sun, 12 Jul 2015 19:37:02 +0000 (21:37 +0200)
The warnings were:
./tcpdump.c: In function 'show_tstamp_types_and_exit':
./tcpdump.c:220:56: warning: declaration of 'pd' shadows a global declaration [-Wshadow]
 show_tstamp_types_and_exit(const char *device, pcap_t *pd)
                                                        ^
./tcpdump.c:200:16: warning: shadowed declaration is here [-Wshadow]
 static pcap_t *pd;
                ^
./tcpdump.c: In function 'show_dlts_and_exit':
./tcpdump.c:253:48: warning: declaration of 'pd' shadows a global declaration [-Wshadow]
 show_dlts_and_exit(const char *device, pcap_t *pd)
                                                ^
./tcpdump.c:200:16: warning: shadowed declaration is here [-Wshadow]
 static pcap_t *pd;
                ^

tcpdump.c

index 13becf7ee69a9b31a5614c65b47da91f02a31011..29a70cee93992aa08ba86a82a73881cca02d9159 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -164,7 +164,8 @@ static RETSIGTYPE cleanup(int);
 static RETSIGTYPE child_cleanup(int);
 static void print_version(void);
 static void print_usage(void);
-static void show_dlts_and_exit(const char *device, pcap_t *pd) __attribute__((noreturn));
+static void show_tstamp_types_and_exit(const char *device) __attribute__((noreturn));
+static void show_dlts_and_exit(const char *device) __attribute__((noreturn));
 
 static void print_packet(u_char *, const struct pcap_pkthdr *, const u_char *);
 static void dump_packet_and_trunc(u_char *, const struct pcap_pkthdr *, const u_char *);
@@ -217,7 +218,7 @@ struct dump_info {
 
 #ifdef HAVE_PCAP_SET_TSTAMP_TYPE
 static void
-show_tstamp_types_and_exit(const char *device, pcap_t *pd)
+show_tstamp_types_and_exit(const char *device)
 {
        int n_tstamp_types;
        int *tstamp_types = 0;
@@ -250,7 +251,7 @@ show_tstamp_types_and_exit(const char *device, pcap_t *pd)
 #endif
 
 static void
-show_dlts_and_exit(const char *device, pcap_t *pd)
+show_dlts_and_exit(const char *device)
 {
        int n_dlts, i;
        int *dlts = 0;
@@ -1321,7 +1322,7 @@ main(int argc, char **argv)
                        error("%s", ebuf);
 #ifdef HAVE_PCAP_SET_TSTAMP_TYPE
                if (Jflag)
-                       show_tstamp_types_and_exit(device, pd);
+                       show_tstamp_types_and_exit(device);
 #endif
 #ifdef HAVE_PCAP_SET_TSTAMP_PRECISION
                status = pcap_set_tstamp_precision(pd, ndo->ndo_tstamp_precision);
@@ -1442,7 +1443,7 @@ main(int argc, char **argv)
                        }
 #endif /* !defined(HAVE_PCAP_CREATE) && defined(WIN32) */
                if (Lflag)
-                       show_dlts_and_exit(device, pd);
+                       show_dlts_and_exit(device);
                if (ndo->ndo_dlt >= 0) {
 #ifdef HAVE_PCAP_SET_DATALINK
                        if (pcap_set_datalink(pd, ndo->ndo_dlt) < 0)