summaryrefslogtreecommitdiffstats
path: root/Source/cmSourceGroupCommand.cxx
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-08-24 14:58:53 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2007-08-24 14:58:53 (GMT)
commit6d508a3094c31910728b24e13ceebbc3070b5e04 (patch)
tree1ff178c3835078c25c149dd4678a15f002252034 /Source/cmSourceGroupCommand.cxx
parente7a1b85f76b38fc8b6889752ca4b5625b05b0cbd (diff)
downloadCMake-6d508a3094c31910728b24e13ceebbc3070b5e04.zip
CMake-6d508a3094c31910728b24e13ceebbc3070b5e04.tar.gz
CMake-6d508a3094c31910728b24e13ceebbc3070b5e04.tar.bz2
BUG: handle source_group names which consist only of the delimiter the same was as empty source group names
Alex
Diffstat (limited to 'Source/cmSourceGroupCommand.cxx')
-rw-r--r--Source/cmSourceGroupCommand.cxx15
1 files changed, 7 insertions, 8 deletions
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index 67651c6..a013cc9 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -20,17 +20,11 @@ inline std::vector<std::string> tokenize(const std::string& str,
const std::string& sep)
{
std::vector<std::string> tokens;
- if(str.size() == 0)
- {
- tokens.push_back("");
- return tokens;
- }
- std::string::size_type tokstart,tokend;
+ std::string::size_type tokend = 0;
- tokend=0;
do
{
- tokstart=str.find_first_not_of(sep,tokend);
+ std::string::size_type tokstart=str.find_first_not_of(sep, tokend);
if (tokstart==std::string::npos)
{
break; // no more tokens
@@ -45,6 +39,11 @@ inline std::vector<std::string> tokenize(const std::string& str,
tokens.push_back(str.substr(tokstart,tokend-tokstart));
}
} while (tokend!=std::string::npos);
+
+ if (tokens.empty())
+ {
+ tokens.push_back("");
+ }
return tokens;
}