1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Remove some redundant variables and assignments.

This fixes a batch of clang-analyzer warnings of the form 'you
declared / assigned this variable and then never use it'. It doesn't
fix _all_ of them - some are there so that when I add code in the
future _it_ can use the variable without me having to remember to
start setting it - but these are the ones I thought it would make the
code better instead of worse to fix.
This commit is contained in:
Simon Tatham
2018-12-01 14:06:44 +00:00
parent d2ff948207
commit b54147de4b
9 changed files with 19 additions and 29 deletions

View File

@ -735,13 +735,10 @@ static void columns_alloc_horiz(Columns *cols, gint ourwidth,
ColumnsChild *child;
GList *children;
gint i, ncols, colspan, border, *colxpos, childwidth;
const gint *percentages;
static const gint onecol[] = { 100 };
border = gtk_container_get_border_width(GTK_CONTAINER(cols));
ncols = 1;
percentages = onecol;
/* colxpos gives the starting x position of each column.
* We supply n+1 of them, so that we can find the RH edge easily.
* All ending x positions are expected to be adjusted afterwards by
@ -759,12 +756,11 @@ static void columns_alloc_horiz(Columns *cols, gint ourwidth,
/* Column reconfiguration. */
ncols = child->ncols;
percentages = child->percentages;
colxpos = g_renew(gint, colxpos, ncols + 1);
colxpos[0] = 0;
percent = 0;
for (i = 0; i < ncols; i++) {
percent += percentages[i];
percent += child->percentages[i];
colxpos[i+1] = (((ourwidth - 2*border) + cols->spacing)
* percent / 100);
}

View File

@ -794,7 +794,6 @@ Socket *sk_new(SockAddr *addr, int port, bool privport, bool oobinline,
ret->privport = privport;
ret->port = port;
err = 0;
do {
err = try_connect(ret);
} while (err && sk_nextaddr(ret->addr, &ret->step));

View File

@ -734,14 +734,14 @@ void run_agent(void)
unsigned long now;
int *fdlist;
int fd;
int i, fdcount, fdsize, fdstate;
int i, fdsize, fdstate;
int termination_pid = -1;
bool errors = false;
Conf *conf;
const struct cmdline_key_action *act;
fdlist = NULL;
fdcount = fdsize = 0;
fdsize = 0;
pageant_init();
@ -891,7 +891,7 @@ void run_agent(void)
* Add all currently open fds to the select sets, and store
* them in fdlist as well.
*/
fdcount = 0;
int fdcount = 0;
for (fd = first_fd(&fdstate, &rwx); fd >= 0;
fd = next_fd(&fdstate, &rwx)) {
fdlist[fdcount++] = fd;

View File

@ -561,7 +561,7 @@ int main(int argc, char **argv)
bool sending;
int *fdlist;
int fd;
int i, fdcount, fdsize, fdstate;
int i, fdsize, fdstate;
int exitcode;
bool errors;
bool use_subsystem = false;
@ -571,7 +571,7 @@ int main(int argc, char **argv)
const struct BackendVtable *backvt;
fdlist = NULL;
fdcount = fdsize = 0;
fdsize = 0;
/*
* Initialise port and protocol to sensible defaults. (These
* will be overridden by more or less anything.)
@ -878,7 +878,7 @@ int main(int argc, char **argv)
* Add all currently open fds to the select sets, and store
* them in fdlist as well.
*/
fdcount = 0;
int fdcount = 0;
for (fd = first_fd(&fdstate, &rwx); fd >= 0;
fd = next_fd(&fdstate, &rwx)) {
fdlist[fdcount++] = fd;

View File

@ -359,7 +359,7 @@ int main(int argc, char **argv)
{
int *fdlist;
int fd;
int i, fdcount, fdsize, fdstate;
int i, fdsize, fdstate;
unsigned long now;
ssh_key **hostkeys = NULL;
@ -531,7 +531,7 @@ int main(int argc, char **argv)
}
fdlist = NULL;
fdcount = fdsize = 0;
fdsize = 0;
random_ref();
@ -580,7 +580,7 @@ int main(int argc, char **argv)
* Add all currently open fds to the select sets, and store
* them in fdlist as well.
*/
fdcount = 0;
int fdcount = 0;
for (fd = first_fd(&fdstate, &rwx); fd >= 0;
fd = next_fd(&fdstate, &rwx)) {
fdlist[fdcount++] = fd;

View File

@ -445,14 +445,14 @@ char *dir_file_cat(const char *dir, const char *file)
static int ssh_sftp_do_select(bool include_stdin, bool no_fds_ok)
{
fd_set rset, wset, xset;
int i, fdcount, fdsize, *fdlist;
int fd, fdstate, rwx, ret, maxfd;
int i, fdsize, *fdlist;
int fd, fdcount, fdstate, rwx, ret, maxfd;
unsigned long now = GETTICKCOUNT();
unsigned long next;
bool done_something = false;
fdlist = NULL;
fdcount = fdsize = 0;
fdsize = 0;
do {