mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-10-12 23:43:59 +03:00
Reduce scope of variable
Found by Cppcheck (variableScope)
This commit is contained in:
1 parent
01c22dfaee
commit
c934a881e7
3 files changed
+4
-9
No files matched your search
@@ -55,7 +55,6 @@ int cmCPackIFWGenerator::PackageFiles()
|
||||
std::vector<std::string> cmCPackIFWGenerator::BuildRepogenCommand()
|
||||
{
|
||||
std::vector<std::string> ifwCmd;
|
||||
std::string ifwArg;
|
||||
|
||||
ifwCmd.emplace_back(this->RepoGen);
|
||||
|
||||
@@ -104,7 +103,7 @@ std::vector<std::string> cmCPackIFWGenerator::BuildRepogenCommand()
|
||||
if (!this->OnlineOnly && !this->DownloadedPackages.empty()) {
|
||||
ifwCmd.emplace_back("-i");
|
||||
auto it = this->DownloadedPackages.begin();
|
||||
ifwArg = (*it)->Name;
|
||||
std::string ifwArg = (*it)->Name;
|
||||
++it;
|
||||
while (it != this->DownloadedPackages.end()) {
|
||||
ifwArg += "," + (*it)->Name;
|
||||
|
||||
@@ -565,7 +565,6 @@ int cmCTestScriptHandler::CheckOutSourceDir()
|
||||
{
|
||||
std::string output;
|
||||
int retVal;
|
||||
bool res;
|
||||
|
||||
if (!cmSystemTools::FileExists(this->SourceDir) &&
|
||||
!this->CVSCheckOut.empty()) {
|
||||
@@ -573,7 +572,7 @@ int cmCTestScriptHandler::CheckOutSourceDir()
|
||||
output.clear();
|
||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||
"Run cvs: " << this->CVSCheckOut << std::endl);
|
||||
res = cmSystemTools::RunSingleCommand(
|
||||
bool res = cmSystemTools::RunSingleCommand(
|
||||
this->CVSCheckOut, &output, &output, &retVal, this->CTestRoot.c_str(),
|
||||
this->HandlerVerbose, cmDuration::zero() /*this->TimeOut*/);
|
||||
if (!res || retVal != 0) {
|
||||
@@ -586,8 +585,6 @@ int cmCTestScriptHandler::CheckOutSourceDir()
|
||||
|
||||
int cmCTestScriptHandler::BackupDirectories()
|
||||
{
|
||||
int retVal;
|
||||
|
||||
// compute the backup names
|
||||
this->BackupSourceDir = cmStrCat(this->SourceDir, "_CMakeBackup");
|
||||
this->BackupBinaryDir = cmStrCat(this->BinaryDir, "_CMakeBackup");
|
||||
@@ -607,7 +604,7 @@ int cmCTestScriptHandler::BackupDirectories()
|
||||
rename(this->BinaryDir.c_str(), this->BackupBinaryDir.c_str());
|
||||
|
||||
// we must now checkout the src dir
|
||||
retVal = this->CheckOutSourceDir();
|
||||
int retVal = this->CheckOutSourceDir();
|
||||
if (retVal) {
|
||||
this->RestoreBackupDirectories();
|
||||
return retVal;
|
||||
|
||||
@@ -118,7 +118,6 @@ int posix(const char* jobserver, char* message)
|
||||
{
|
||||
int read_fd;
|
||||
int write_fd;
|
||||
const char* path;
|
||||
|
||||
// First try to parse as "R,W" file descriptors
|
||||
if (sscanf(jobserver, "%d,%d", &read_fd, &write_fd) == 2) {
|
||||
@@ -127,7 +126,7 @@ int posix(const char* jobserver, char* message)
|
||||
|
||||
// Then try to parse as "fifo:PATH"
|
||||
if (strncmp(jobserver, "fifo:", 5) == 0) {
|
||||
path = jobserver + 5;
|
||||
const char* path = jobserver + 5;
|
||||
read_fd = open(path, O_RDONLY);
|
||||
write_fd = open(path, O_WRONLY);
|
||||
return test_fd(read_fd, write_fd, message);
|
||||
|
||||
Reference in new issue
Block a user