diff options
| author | Aleix Pol <aleixpol@kde.org> | 2016-04-27 17:10:30 +0200 | 
|---|---|---|
| committer | Aleix Pol <aleixpol@kde.org> | 2016-04-27 17:10:30 +0200 | 
| commit | 61757c5aa46c7f851dd2d44adf7e69dfd52b40f9 (patch) | |
| tree | 6b75fdd88d934721b71d75fd595ad2eaec2e17bc /src | |
| parent | ced9046b4686dc1c03d72bc24fabbc2baf1b7201 (diff) | |
| download | kconfig-61757c5aa46c7f851dd2d44adf7e69dfd52b40f9.tar.gz kconfig-61757c5aa46c7f851dd2d44adf7e69dfd52b40f9.tar.bz2 | |
Remove unneeded ifdefs to compare paths
Just keep the setting once and always use QString::compare instead of
using QString::operator== or QString::compare depending on the platform.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/kconfig.cpp | 25 | 
1 files changed, 10 insertions, 15 deletions
| diff --git a/src/core/kconfig.cpp b/src/core/kconfig.cpp index 9f17e579..5b72b1ad 100644 --- a/src/core/kconfig.cpp +++ b/src/core/kconfig.cpp @@ -59,6 +59,12 @@ bool KConfigPrivate::mappingsRegistered = false;  Q_GLOBAL_STATIC(QStringList, s_globalFiles) // For caching purposes.  static QBasicMutex s_globalFilesMutex; +#ifndef Q_OS_WIN +static const Qt::CaseSensitivity sPathCaseSensitivity = Qt::CaseSensitive; +#else +static const Qt::CaseSensitivity sPathCaseSensitivity = Qt::CaseInsensitive; +#endif +  KConfigPrivate::KConfigPrivate(KConfig::OpenFlags flags,                                 QStandardPaths::StandardLocation resourceType)      : openFlags(flags), resourceType(resourceType), mBackend(Q_NULLPTR), @@ -610,11 +616,7 @@ void KConfigPrivate::changeFileName(const QString &name)      Q_ASSERT(!file.isEmpty()); -#ifndef Q_OS_WIN -    bSuppressGlobal = (file == sGlobalFileName); -#else -    bSuppressGlobal = (file.compare(sGlobalFileName, Qt::CaseInsensitive) == 0); -#endif +    bSuppressGlobal = (file.compare(sGlobalFileName, sPathCaseSensitivity) == 0);      if (bDynamicBackend || !mBackend) { // allow dynamic changing of backend          mBackend = KConfigBackend::create(file); @@ -689,11 +691,8 @@ void KConfigPrivate::parseGlobalFiles()      const QByteArray utf8Locale = locale.toUtf8();      Q_FOREACH (const QString &file, globalFiles) {          KConfigBackend::ParseOptions parseOpts = KConfigBackend::ParseGlobal | KConfigBackend::ParseExpansions; -#ifndef Q_OS_WIN -        if (file != sGlobalFileName) -#else -        if (file.compare(sGlobalFileName, Qt::CaseInsensitive) != 0) -#endif + +        if (file.compare(sGlobalFileName, sPathCaseSensitivity) != 0)              parseOpts |= KConfigBackend::ParseDefaults;          QExplicitlySharedDataPointer<KConfigBackend> backend = KConfigBackend::create(file); @@ -740,11 +739,7 @@ void KConfigPrivate::parseConfigFiles()          const QByteArray utf8Locale = locale.toUtf8();          foreach (const QString &file, files) { -#ifndef Q_OS_WIN -            if (file == mBackend->filePath()) { -#else -            if (file.compare(mBackend->filePath(), Qt::CaseInsensitive) == 0) { -#endif +            if (file.compare(mBackend->filePath(), sPathCaseSensitivity) == 0) {                  switch (mBackend->parseConfig(utf8Locale, entryMap, KConfigBackend::ParseExpansions)) {                  case KConfigBackend::ParseOk:                      break; | 
