From: simon Date: Thu, 11 Jul 2013 17:24:10 +0000 (+0000) Subject: Remove redundant null checks for arguments to sftp_{get,put}_file X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/9711e33312f162133098568f408fc5165cf7e06d Remove redundant null checks for arguments to sftp_{get,put}_file which are (a) never NULL anyway, and (b) have already been dereferenced by the time we make those checks so it would be too late if they were. git-svn-id: svn://svn.tartarus.org/sgt/putty@9906 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/psftp.c b/psftp.c index 33fbf086..b6a2bb58 100644 --- a/psftp.c +++ b/psftp.c @@ -342,11 +342,8 @@ int sftp_get_file(char *fname, char *outfname, int recurse, int restart) while (i < nnames) { char *nextoutfname; int ret; - if (outfname) - nextoutfname = dir_file_cat(outfname, - ournames[i]->filename); - else - nextoutfname = dupstr(ournames[i]->filename); + nextoutfname = dir_file_cat(outfname, + ournames[i]->filename); ret = (file_type(nextoutfname) == FILE_TYPE_NONEXISTENT); sfree(nextoutfname); if (ret) @@ -368,11 +365,7 @@ int sftp_get_file(char *fname, char *outfname, int recurse, int restart) int ret; nextfname = dupcat(fname, "/", ournames[i]->filename, NULL); - if (outfname) - nextoutfname = dir_file_cat(outfname, - ournames[i]->filename); - else - nextoutfname = dupstr(ournames[i]->filename); + nextoutfname = dir_file_cat(outfname, ournames[i]->filename); ret = sftp_get_file(nextfname, nextoutfname, recurse, restart); restart = FALSE; /* after first partial file, do full */ sfree(nextoutfname); @@ -614,10 +607,7 @@ int sftp_put_file(char *fname, char *outfname, int recurse, int restart) char *nextfname, *nextoutfname; int ret; - if (fname) - nextfname = dir_file_cat(fname, ournames[i]); - else - nextfname = dupstr(ournames[i]); + nextfname = dir_file_cat(fname, ournames[i]); nextoutfname = dupcat(outfname, "/", ournames[i], NULL); ret = sftp_put_file(nextfname, nextoutfname, recurse, restart); restart = FALSE; /* after first partial file, do full */