From 69c2ecbdc937e3c73fe67d3c9bce12a80d3ec7ec Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 10 Mar 2013 12:24:13 +0100 Subject: various simple changes to fix cppcheck warnings --- apt-pkg/contrib/netrc.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'apt-pkg/contrib/netrc.cc') diff --git a/apt-pkg/contrib/netrc.cc b/apt-pkg/contrib/netrc.cc index 0a902f126..de95aa4ab 100644 --- a/apt-pkg/contrib/netrc.cc +++ b/apt-pkg/contrib/netrc.cc @@ -50,14 +50,10 @@ static int parsenetrc_string (char *host, std::string &login, std::string &passw FILE *file; int retcode = 1; int specific_login = (login.empty() == false); - char *home = NULL; bool netrc_alloc = false; - int state_our_login = false; /* With specific_login, - found *our* login name */ - if (!netrcfile) { - home = getenv ("HOME"); /* portable environment reader */ + char const * home = getenv ("HOME"); /* portable environment reader */ if (!home) { struct passwd *pw; @@ -86,6 +82,8 @@ static int parsenetrc_string (char *host, std::string &login, std::string &passw int state = NOTHING; char state_login = 0; /* Found a login keyword */ char state_password = 0; /* Found a password keyword */ + int state_our_login = false; /* With specific_login, + found *our* login name */ while (!done && getline(&netrcbuffer, &netrcbuffer_size, file) != -1) { tok = strtok_r (netrcbuffer, " \t\n", &tok_buf); -- cgit v1.2.3