summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-03-12 17:24:47 +0100
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-06-19 16:40:00 +0200
commitad92c6c7dea988eeeb6f75c6dfb37645e3086cef (patch)
treec2ff9e692e88918dff7f92904b0c622023642f1f /qmake
parentf4b7e33c0b39b33542194b06d6268a841a55a469 (diff)
make splitPathList() return an empty list for an empty string
this makes the user code a bit cleaner Change-Id: I3713c73c5c19cf69341be65480917eda0b967b77 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Diffstat (limited to 'qmake')
-rw-r--r--qmake/option.h2
-rw-r--r--qmake/project.cpp28
2 files changed, 10 insertions, 20 deletions
diff --git a/qmake/option.h b/qmake/option.h
index c58ef4aed0..3aa7d6d8c3 100644
--- a/qmake/option.h
+++ b/qmake/option.h
@@ -218,7 +218,7 @@ private:
};
inline QString fixEnvVariables(const QString &x) { return Option::fixString(x, Option::FixEnvVars); }
-inline QStringList splitPathList(const QString &paths) { return paths.split(Option::dirlist_sep); }
+inline QStringList splitPathList(const QString &paths) { return paths.isEmpty() ? QStringList() : paths.split(Option::dirlist_sep); }
QT_END_NAMESPACE
diff --git a/qmake/project.cpp b/qmake/project.cpp
index f7102162b8..768a1c2922 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -586,10 +586,7 @@ QStringList qmake_feature_paths(QMakeProperty *prop, bool host_build)
concat << base_concat;
}
- QStringList feature_roots;
- QByteArray mkspec_path = qgetenv("QMAKEFEATURES");
- if(!mkspec_path.isNull())
- feature_roots += splitPathList(QString::fromLocal8Bit(mkspec_path));
+ QStringList feature_roots = splitPathList(QString::fromLocal8Bit(qgetenv("QMAKEFEATURES")));
if(prop)
feature_roots += splitPathList(prop->value("QMAKEFEATURES"));
if(!Option::mkfile::cachefile.isEmpty()) {
@@ -601,15 +598,10 @@ QStringList qmake_feature_paths(QMakeProperty *prop, bool host_build)
concat_it != concat.end(); ++concat_it)
feature_roots << (path + (*concat_it));
}
- QByteArray qmakepath = qgetenv("QMAKEPATH");
- if (!qmakepath.isNull()) {
- const QStringList lst = splitPathList(QString::fromLocal8Bit(qmakepath));
- for(QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it) {
- for(QStringList::Iterator concat_it = concat.begin();
- concat_it != concat.end(); ++concat_it)
- feature_roots << ((*it) + mkspecs_concat + (*concat_it));
- }
- }
+ QStringList qmakepath = splitPathList(QString::fromLocal8Bit(qgetenv("QMAKEPATH")));
+ foreach (const QString &path, qmakepath)
+ foreach (const QString &cat, concat)
+ feature_roots << (path + mkspecs_concat + cat);
QString *specp = host_build ? &Option::mkfile::qmakespec : &Option::mkfile::xqmakespec;
if (!specp->isEmpty()) {
// The spec is already platform-dependent, so no subdirs here.
@@ -643,12 +635,10 @@ QStringList qmake_mkspec_paths()
{
QStringList ret;
const QString concat = QLatin1String("/mkspecs");
- QByteArray qmakepath = qgetenv("QMAKEPATH");
- if (!qmakepath.isEmpty()) {
- const QStringList lst = splitPathList(QString::fromLocal8Bit(qmakepath));
- for (QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it)
- ret << ((*it) + concat);
- }
+
+ QStringList qmakepath = splitPathList(QString::fromLocal8Bit(qgetenv("QMAKEPATH")));
+ foreach (const QString &path, qmakepath)
+ ret << (path + concat);
if (!project_build_root.isEmpty())
ret << project_build_root + concat;
if (!project_root.isEmpty())