summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/strutl.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-02-24 23:10:25 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2014-03-13 13:57:34 +0100
commita5414e56403537678d5be87acf59c37a05f55719 (patch)
treee68d95ae7867e4723e4aa69f8a9ede1e36eb0df2 /apt-pkg/contrib/strutl.cc
parentfa19cc9573aac19cfbf43364d4b5660c9ab645bc (diff)
add default and override handling for Cnf::FindVector
Automatically handle the override of list options via its parent value which can even be a comma-separated list of values. It also adds an easy way of providing a default for the list.
Diffstat (limited to 'apt-pkg/contrib/strutl.cc')
-rw-r--r--apt-pkg/contrib/strutl.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index d4f53ea3a..f8bb3890d 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -1130,9 +1130,11 @@ bool TokSplitString(char Tok,char *Input,char **List,
also, but the advantage is that we have an iteratable vector */
vector<string> VectorizeString(string const &haystack, char const &split)
{
+ vector<string> exploded;
+ if (haystack.empty() == true)
+ return exploded;
string::const_iterator start = haystack.begin();
string::const_iterator end = start;
- vector<string> exploded;
do {
for (; end != haystack.end() && *end != split; ++end);
exploded.push_back(string(start, end));