Menu

#7 Remove unused variables

v1.0 (example)
open
Tim Cook
None
5
2014-09-30
2014-09-30
No

This patch handles two unused variables (one is used only for solaris, the other used nowhere), found when compiling with -Wall on Linux:

diff --git a/nicstat.c b/nicstat.c
index 33e8e75..379d6e2 100644
--- a/nicstat.c
+++ b/nicstat.c
@@ -281,7 +281,6 @@ static int g_udp;                   /* show UDP stats */
 static int g_tcp;                      /* show TCP stats */
 static int g_opt_x;
 static int g_opt_p;
-static int g_opt_k;
 static int g_verbose;
 static int g_forever;                  /* run forever */
 static char **g_tracked;               /* tracked interfaces */
@@ -300,6 +299,7 @@ static char *g_wunit_2 = "WrKB";
 static int g_sock;                     /* Socket for interface ioctl's */

 #ifdef OS_SOLARIS
+static int g_opt_k;
 static kstat_ctl_t *g_kc;              /* kstat chain pointer */
 static int g_new_kstat_chain = B_TRUE; /* kstat chain updated */
 #ifdef USE_DLADM
@@ -2344,7 +2344,6 @@ init_if_speed_list(char *speed_list)
        struct if_speed_list    *list_elem;
        char                    *speed_list_save_ptr;
        char                    *if_record;
-       char                    *if_record_save_ptr;
        char                    name[32];
        uint64_t                speed;
        char                    duplex_s[32];

Fixing in my fork https://github.com/scotte/nicstat along with the other bugs here.

Discussion


Log in to post a comment.