/usr/src/*bin: remove unused variables

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

/usr/src/*bin: remove unused variables

Klemens Nanni-2
COPTS=-Wunused yielded the following diff which removes unused variables
as well as one function.

No object change for any of those programs.

OK?


Index: sbin/vnconfig/vnconfig.c
===================================================================
RCS file: /cvs/src/sbin/vnconfig/vnconfig.c,v
retrieving revision 1.5
diff -u -p -r1.5 vnconfig.c
--- sbin/vnconfig/vnconfig.c 28 Jun 2019 13:32:46 -0000 1.5
+++ sbin/vnconfig/vnconfig.c 5 Apr 2021 20:46:54 -0000
@@ -331,7 +331,7 @@ int
 unconfig(char *vnd)
 {
  struct vnd_ioctl vndio;
- int fd, rv = -1, unit;
+ int fd, rv = -1;
  char *rdev;
 
  if ((fd = opendev(vnd, O_RDONLY, OPENDEV_PART, &rdev)) == -1)
Index: usr.sbin/pcidump/pcidump.c
===================================================================
RCS file: /cvs/src/usr.sbin/pcidump/pcidump.c,v
retrieving revision 1.63
diff -u -p -r1.63 pcidump.c
--- usr.sbin/pcidump/pcidump.c 5 Mar 2021 20:06:39 -0000 1.63
+++ usr.sbin/pcidump/pcidump.c 5 Apr 2021 21:05:44 -0000
@@ -358,7 +358,7 @@ print_vpd(const uint8_t *buf, size_t len
  const struct pci_vpd *vpd;
  char key0[8];
  char key1[8];
- size_t vlen, i;
+ size_t vlen;
 
  while (len > 0) {
  if (len < sizeof(*vpd))
@@ -392,7 +392,6 @@ dump_vpd(int bus, int dev, int func)
  uint32_t data[64]; /* XXX this can be up to 32k of data */
  uint8_t *buf = (uint8_t *)data;
  size_t len = sizeof(data);
- size_t i;
 
  bzero(&io, sizeof(io));
  io.pv_sel.pc_bus = bus;
Index: usr.sbin/wsfontload/wsfontload.c
===================================================================
RCS file: /cvs/src/usr.sbin/wsfontload/wsfontload.c,v
retrieving revision 1.23
diff -u -p -r1.23 wsfontload.c
--- usr.sbin/wsfontload/wsfontload.c 5 Aug 2020 13:56:06 -0000 1.23
+++ usr.sbin/wsfontload/wsfontload.c 5 Apr 2021 21:06:51 -0000
@@ -77,7 +77,7 @@ main(int argc, char *argv[])
  char *wsdev, *infile, *p;
  struct wsdisplay_font f;
  struct wsdisplay_screentype screens;
- int c, res, wsfd, ffd, type, list, i;
+ int c, res, wsfd, ffd, list, i;
  int defwidth, defheight;
  struct stat stat;
  size_t len;
Index: usr.bin/fstat/fstat.c
===================================================================
RCS file: /cvs/src/usr.bin/fstat/fstat.c,v
retrieving revision 1.101
diff -u -p -r1.101 fstat.c
--- usr.bin/fstat/fstat.c 22 Aug 2020 18:34:29 -0000 1.101
+++ usr.bin/fstat/fstat.c 5 Apr 2021 21:01:02 -0000
@@ -142,7 +142,6 @@ hide(void *p)
 int
 main(int argc, char *argv[])
 {
- struct passwd *passwd;
  struct kinfo_file *kf, *kflast;
  int ch;
  char *memf, *nlistf, *optstr;
Index: usr.bin/less/line.c
===================================================================
RCS file: /cvs/src/usr.bin/less/line.c,v
retrieving revision 1.33
diff -u -p -r1.33 line.c
--- usr.bin/less/line.c 3 Sep 2019 23:08:42 -0000 1.33
+++ usr.bin/less/line.c 5 Apr 2021 21:02:40 -0000
@@ -434,7 +434,7 @@ static int
 backc(void)
 {
  wchar_t ch, prev_ch;
- int i, len, width;
+ int len, width;
 
  if ((len = mbtowc_left(&ch, linebuf + curr, curr)) <= 0)
  return (0);
Index: usr.bin/make/engine.c
===================================================================
RCS file: /cvs/src/usr.bin/make/engine.c,v
retrieving revision 1.69
diff -u -p -r1.69 engine.c
--- usr.bin/make/engine.c 26 Jan 2020 12:41:21 -0000 1.69
+++ usr.bin/make/engine.c 5 Apr 2021 21:04:13 -0000
@@ -685,7 +685,6 @@ handle_job_status(Job *job, int status)
 int
 run_gnode(GNode *gn)
 {
- Job *j;
  if (!gn || (gn->type & OP_DUMMY))
  return NOSUCHNODE;
 
Index: usr.bin/systat/cpu.c
===================================================================
RCS file: /cvs/src/usr.bin/systat/cpu.c,v
retrieving revision 1.10
diff -u -p -r1.10 cpu.c
--- usr.bin/systat/cpu.c 28 Jun 2019 13:35:04 -0000 1.10
+++ usr.bin/systat/cpu.c 5 Apr 2021 21:11:34 -0000
@@ -192,7 +192,7 @@ initcpu(void)
 {
  field_view *v;
  size_t size = sizeof(cpu_count);
- int mib[2], i;
+ int mib[2];
 
  mib[0] = CTL_HW;
  mib[1] = HW_NCPU;
Index: usr.bin/ctfconv/dw.c
===================================================================
RCS file: /cvs/src/usr.bin/ctfconv/dw.c,v
retrieving revision 1.4
diff -u -p -r1.4 dw.c
--- usr.bin/ctfconv/dw.c 27 Sep 2017 08:59:38 -0000 1.4
+++ usr.bin/ctfconv/dw.c 5 Apr 2021 20:59:04 -0000
@@ -50,10 +50,6 @@ static int dw_read_buf(struct dwbuf *,
 
 static int dw_skip_bytes(struct dwbuf *, size_t);
 
-static int dw_read_filename(struct dwbuf *, const char **, const char **,
-     uint8_t, uint64_t);
-
-
 static int dw_attr_parse(struct dwbuf *, struct dwattr *, uint8_t,
      struct dwaval_queue *);
 static void dw_attr_purge(struct dwaval_queue *);
@@ -167,55 +163,6 @@ dw_skip_bytes(struct dwbuf *d, size_t n)
  d->len -= n;
  return 0;
 }
-
-static int
-dw_read_filename(struct dwbuf *names, const char **outdirname,
-    const char **outbasename, uint8_t opcode_base, uint64_t file)
-{
- struct dwbuf dirnames;
- const char *basename = NULL, *dirname = NULL;
- uint64_t mtime, size, dummy, dir = 0;
- const char *name;
- size_t i;
-
- if (file == 0)
- return -1;
-
- /* Skip over opcode table. */
- for (i = 1; i < opcode_base; i++) {
- if (dw_read_uleb128(names, &dummy))
- return -1;
- }
-
- /* Skip over directory name table for now. */
- dirnames = *names;
- for (;;) {
- if (dw_read_string(names, &name))
- return -1;
- if (*name == '\0')
- break;
- }
-
- /* Locate file entry. */
- for (i = 0; i < file; i++) {
- if (dw_read_string(names, &basename) || *basename == '\0' ||
-    dw_read_uleb128(names, &dir) ||
-    dw_read_uleb128(names, &mtime) ||
-    dw_read_uleb128(names, &size))
- return -1;
- }
-
- for (i = 0; i < dir; i++) {
- if (!dw_read_string(&dirnames, &dirname) || *dirname == '\0')
- return -1;
- }
-
- *outdirname = dirname;
- *outbasename = basename;
-
- return 0;
-}
-
 
 const char *
 dw_tag2name(uint64_t tag)