From 7f97a6c94b59be7e7eba7362ce3eecdcff79ab70 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 18 Aug 2016 19:47:32 +0200 Subject: [PATCH] CPack: don't use else after return --- Source/CPack/cmCPackArchiveGenerator.cxx | 6 ++---- Source/CPack/cmCPackDebGenerator.cxx | 13 ++++--------- Source/CPack/cmCPackGenerator.cxx | 3 ++- Source/CPack/cmCPackRPMGenerator.cxx | 13 ++++--------- 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 9120a2f45..0d3725d01 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -231,10 +231,8 @@ int cmCPackArchiveGenerator::PackageFiles() // There will be 1 package for each component group // however one may require to ignore component group and // in this case you'll get 1 package for each component. - else { - return PackageComponents(componentPackageMethod == - ONE_PACKAGE_PER_COMPONENT); - } + return PackageComponents(componentPackageMethod == + ONE_PACKAGE_PER_COMPONENT); } // CASE 3 : NON COMPONENT package. diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 3edc430b0..1f3ac5155 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -242,15 +242,11 @@ int cmCPackDebGenerator::PackageFiles() // There will be 1 package for each component group // however one may require to ignore component group and // in this case you'll get 1 package for each component. - else { - return PackageComponents(componentPackageMethod == - ONE_PACKAGE_PER_COMPONENT); - } + return PackageComponents(componentPackageMethod == + ONE_PACKAGE_PER_COMPONENT); } // CASE 3 : NON COMPONENT package. - else { - return PackageComponentsAllInOne(""); - } + return PackageComponentsAllInOne(""); } int cmCPackDebGenerator::createDeb() @@ -694,9 +690,8 @@ std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix( "CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP"; if (CM_NULLPTR != GetOption(groupVar)) { return std::string(GetOption(groupVar)); - } else { - return componentName; } + return componentName; } // The following code is taken from OpenBSD ar: diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 58a22432b..96c218cad 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -67,7 +67,8 @@ int cmCPackGenerator::PrepareNames() cmCPackLog::LOG_ERROR, "CPACK_SET_DESTDIR is set to ON but the '" << Name << "' generator does NOT support it." << std::endl); return 0; - } else if (SETDESTDIR_SHOULD_NOT_BE_USED == SupportsSetDestdir()) { + } + if (SETDESTDIR_SHOULD_NOT_BE_USED == SupportsSetDestdir()) { cmCPackLogger(cmCPackLog::LOG_WARNING, "CPACK_SET_DESTDIR is set to ON but it is " << "usually a bad idea to do that with '" << Name diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index 2568d17d9..5d81a4965 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -215,15 +215,11 @@ int cmCPackRPMGenerator::PackageFiles() // There will be 1 package for each component group // however one may require to ignore component group and // in this case you'll get 1 package for each component. - else { - return PackageComponents(componentPackageMethod == - ONE_PACKAGE_PER_COMPONENT); - } + return PackageComponents(componentPackageMethod == + ONE_PACKAGE_PER_COMPONENT); } // CASE 3 : NON COMPONENT package. - else { - return PackageComponentsAllInOne(""); - } + return PackageComponentsAllInOne(""); } bool cmCPackRPMGenerator::SupportsComponentInstallation() const @@ -247,7 +243,6 @@ std::string cmCPackRPMGenerator::GetComponentInstallDirNameSuffix( "CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP"; if (CM_NULLPTR != GetOption(groupVar)) { return std::string(GetOption(groupVar)); - } else { - return componentName; } + return componentName; }