summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorAmine Chadly <amine.chadly@gmail.com>2012-09-29 17:33:39 (GMT)
committerRolf Eike Beer <eike@sf-mail.de>2012-11-02 16:10:06 (GMT)
commitc2a6cb64af7fdb0e31d5c0781cbd0dabb4197b5a (patch)
tree4fb63407a771e3db9ea4867d72459eb3fec5cceb /Source/cmFileCommand.cxx
parent07251a8ea5322f957adfcbb2fffb6c5ca121418c (diff)
downloadCMake-c2a6cb64af7fdb0e31d5c0781cbd0dabb4197b5a.zip
CMake-c2a6cb64af7fdb0e31d5c0781cbd0dabb4197b5a.tar.gz
CMake-c2a6cb64af7fdb0e31d5c0781cbd0dabb4197b5a.tar.bz2
file: remove dead code
The file command requires at least two arguments, so guarding the GLOB and MAKE_DIRECTORY command is not necessary. Changed it for an assert to keep the protection.
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx15
1 files changed, 5 insertions, 10 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 8de24b3..b877f3c 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -22,6 +22,7 @@
#endif
#undef GetCurrentDirectory
+#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -705,11 +706,8 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
bool recurse)
{
- if ( args.size() < 2 )
- {
- this->SetError("GLOB requires at least a variable name");
- return false;
- }
+ // File commands has at least one argument
+ assert(args.size() > 1);
std::vector<std::string>::const_iterator i = args.begin();
@@ -843,11 +841,8 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
bool cmFileCommand::HandleMakeDirectoryCommand(
std::vector<std::string> const& args)
{
- if(args.size() < 2 )
- {
- this->SetError("called with incorrect number of arguments");
- return false;
- }
+ // File command has at least one argument
+ assert(args.size() > 1);
std::vector<std::string>::const_iterator i = args.begin();