From e3207c200952ae63dad2716ed8fa14568a6d2a99 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Wed, 23 Jan 2013 05:07:44 -0800 Subject: [PATCH] Compiler suggested cleanups --- PDP11/pdp11_vh.c | 3 ++- sim_console.c | 1 - sim_disk.c | 2 -- sim_serial.c | 17 ++++++++--------- sim_timer.c | 2 +- sim_tmxr.c | 3 ++- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/PDP11/pdp11_vh.c b/PDP11/pdp11_vh.c index a1886045..55f4e56f 100644 --- a/PDP11/pdp11_vh.c +++ b/PDP11/pdp11_vh.c @@ -1584,5 +1584,6 @@ static t_stat vh_help_attach (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, ch { char *devtype = (UNIBUS) ? "DH11" : "DHQ11"; -return tmxr_attach_help (st, dptr, uptr, flag, cptr); +fprintf (st, "%s %s Terminal Multiplexer Attach Help\n\n", devtype, dptr->name); +return tmxr_attach_help (st, dptr, uptr, 1, cptr); } diff --git a/sim_console.c b/sim_console.c index 4b6e44c8..2ed8f473 100644 --- a/sim_console.c +++ b/sim_console.c @@ -952,7 +952,6 @@ _console_poll(void *arg) { int sched_policy; struct sched_param sched_priority; -int poll_timeout_count = 0; int wait_count = 0; DEVICE *d; diff --git a/sim_disk.c b/sim_disk.c index 3bb9aed5..91d7eacc 100644 --- a/sim_disk.c +++ b/sim_disk.c @@ -1148,8 +1148,6 @@ return SCPE_OK; t_stat sim_disk_attach_help(FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr) { -size_t unit_number = (uptr-dptr->units); - fprintf (st, "%s Disk Attach Help\n\n", dptr->name); fprintf (st, "Disk container files can be one of 3 different types:\n\n"); diff --git a/sim_serial.c b/sim_serial.c index eab7d9e8..7b13411d 100644 --- a/sim_serial.c +++ b/sim_serial.c @@ -890,19 +890,18 @@ memset(list, 0, max*sizeof(*list)); #if defined(__linux__) if (1) { struct dirent **namelist; - int n; struct stat st; - n = scandir("/sys/class/tty/", &namelist, NULL, NULL); + i = scandir("/sys/class/tty/", &namelist, NULL, NULL); - while (n--) { - if (strcmp(namelist[n]->d_name, ".") && - strcmp(namelist[n]->d_name, "..")) { + while (i--) { + if (strcmp(namelist[i]->d_name, ".") && + strcmp(namelist[i]->d_name, "..")) { char path[1024], devicepath[1024], driverpath[1024]; - sprintf (path, "/sys/class/tty/%s", namelist[n]->d_name); - sprintf (devicepath, "/sys/class/tty/%s/device", namelist[n]->d_name); - sprintf (driverpath, "/sys/class/tty/%s/device/driver", namelist[n]->d_name); + sprintf (path, "/sys/class/tty/%s", namelist[i]->d_name); + sprintf (devicepath, "/sys/class/tty/%s/device", namelist[i]->d_name); + sprintf (driverpath, "/sys/class/tty/%s/device/driver", namelist[i]->d_name); if ((lstat(devicepath, &st) == 0) && S_ISLNK(st.st_mode)) { char buffer[1024]; @@ -918,7 +917,7 @@ if (1) { } } } - free (namelist[n]); + free (namelist[i]); } free (namelist); } diff --git a/sim_timer.c b/sim_timer.c index 3b12840d..2fb5d5cb 100644 --- a/sim_timer.c +++ b/sim_timer.c @@ -1255,7 +1255,7 @@ pthread_mutex_lock (&sim_timer_lock); if (sim_asynch_enabled && sim_asynch_timer) { pthread_attr_t attr; UNIT *cptr; - double delta_due_time; + double delta_due_time = 0; /* when restarting after being manually stopped the due times for all */ /* timer events needs to slide so they fire in the future. (clock ticks */ diff --git a/sim_tmxr.c b/sim_tmxr.c index b1fb7089..d8b63e1f 100644 --- a/sim_tmxr.c +++ b/sim_tmxr.c @@ -2763,7 +2763,8 @@ t_bool single_line = FALSE; /* default to Multi-Line help */ if (mux) single_line = (mux->lines == 1); -fprintf (st, "%s Multiplexer Attach Help\n\n", dptr->name); +if (!flag) + fprintf (st, "%s Multiplexer Attach Help\n\n", dptr->name); if (single_line) { /* Single Line Multiplexer */ fprintf (st, "The %s multiplexer may be connected to terminal emulators supporting the\n", dptr->name); fprintf (st, "Telnet protocol via sockets, or to hardware terminals via host serial\n");