diff options
author | miniak <milan.burda@gmail.com> | 2010-08-03 16:33:13 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-08-03 16:35:29 (GMT) |
commit | 0d6a0f1371d899c4105bc4383550ca1cb6b132b2 (patch) | |
tree | 83863409fd5b67699257cfe50d18d94bb2b30cba /qmake | |
parent | 26f43dcc70a0bcc8aec96a0ca6f648c543b97b10 (diff) | |
download | Qt-0d6a0f1371d899c4105bc4383550ca1cb6b132b2.zip Qt-0d6a0f1371d899c4105bc4383550ca1cb6b132b2.tar.gz Qt-0d6a0f1371d899c4105bc4383550ca1cb6b132b2.tar.bz2 |
qmake: qmakeDeleteCacheClear() function can be template now
Merge-request: 756
Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/cachekeys.h | 9 | ||||
-rw-r--r-- | qmake/generators/makefile.cpp | 4 | ||||
-rw-r--r-- | qmake/option.cpp | 2 | ||||
-rw-r--r-- | qmake/project.cpp | 4 |
4 files changed, 8 insertions, 11 deletions
diff --git a/qmake/cachekeys.h b/qmake/cachekeys.h index 63bd224..c5c1631 100644 --- a/qmake/cachekeys.h +++ b/qmake/cachekeys.h @@ -166,12 +166,9 @@ struct FileFixifyCacheKey inline uint qHash(const FileFixifyCacheKey &f) { return f.hashCode(); } // ------------------------------------------------------------------------------------------------- -// As MSVC 6.0 can't handle template functions that well, we need a separate function for each type -inline void qmakeDeleteCacheClear_QMapStringInt(void *i) { delete reinterpret_cast<QMap<QString,int> *>(i); } -inline void qmakeDeleteCacheClear_QStringList(void *i) { delete reinterpret_cast<QStringList *>(i); } -inline void qmakeDeleteCacheClear_QHashFixStringCacheKeyQString(void *i) { delete reinterpret_cast<QHash<FixStringCacheKey, QString> *>(i); } -inline void qmakeDeleteCacheClear_QHashFileInfoCacheKeyQFileInfo(void *i) { delete reinterpret_cast<QHash<FileInfoCacheKey, QFileInfo> *>(i); } -inline void qmakeDeleteCacheClear_QHashFileFixifyCacheKeyQString(void *i) { delete reinterpret_cast<QHash<FileFixifyCacheKey, QString> *>(i); } +template <typename T> +inline void qmakeDeleteCacheClear(void *i) { delete reinterpret_cast<T*>(i); } + inline void qmakeFreeCacheClear(void *i) { free(i); } typedef void (*qmakeCacheClearFunc)(void *); diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 45a96f5..74c7977 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -2712,7 +2712,7 @@ MakefileGenerator::fileInfo(QString file) const static QFileInfo noInfo = QFileInfo(); if(!cache) { cache = new QHash<FileInfoCacheKey, QFileInfo>; - qmakeAddCacheClear(qmakeDeleteCacheClear_QHashFileInfoCacheKeyQFileInfo, (void**)&cache); + qmakeAddCacheClear(qmakeDeleteCacheClear<QHash<FileInfoCacheKey, QFileInfo> >, (void**)&cache); } FileInfoCacheKey cacheKey(file); QFileInfo value = cache->value(cacheKey, noInfo); @@ -2791,7 +2791,7 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q static QHash<FileFixifyCacheKey, QString> *cache = 0; if(!cache) { cache = new QHash<FileFixifyCacheKey, QString>; - qmakeAddCacheClear(qmakeDeleteCacheClear_QHashFileFixifyCacheKeyQString, (void**)&cache); + qmakeAddCacheClear(qmakeDeleteCacheClear<QHash<FileFixifyCacheKey, QString> >, (void**)&cache); } FileFixifyCacheKey cacheKey(ret, out_d, in_d, fix, canon); QString cacheVal = cache->value(cacheKey); diff --git a/qmake/option.cpp b/qmake/option.cpp index 8db3797..27e7c18 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -621,7 +621,7 @@ Option::fixString(QString string, uchar flags) static QHash<FixStringCacheKey, QString> *cache = 0; if(!cache) { cache = new QHash<FixStringCacheKey, QString>; - qmakeAddCacheClear(qmakeDeleteCacheClear_QHashFixStringCacheKeyQString, (void**)&cache); + qmakeAddCacheClear(qmakeDeleteCacheClear<QHash<FixStringCacheKey, QString> >, (void**)&cache); } FixStringCacheKey cacheKey(string, flags); if(cache->contains(cacheKey)) { diff --git a/qmake/project.cpp b/qmake/project.cpp index cb02923..29d4242 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -87,7 +87,7 @@ QMap<QString, ExpandFunc> qmake_expandFunctions() static QMap<QString, ExpandFunc> *qmake_expand_functions = 0; if(!qmake_expand_functions) { qmake_expand_functions = new QMap<QString, ExpandFunc>; - qmakeAddCacheClear(qmakeDeleteCacheClear_QMapStringInt, (void**)&qmake_expand_functions); + qmakeAddCacheClear(qmakeDeleteCacheClear<QMap<QString, ExpandFunc> >, (void**)&qmake_expand_functions); qmake_expand_functions->insert("member", E_MEMBER); qmake_expand_functions->insert("first", E_FIRST); qmake_expand_functions->insert("last", E_LAST); @@ -1631,7 +1631,7 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QMap<QString, QStringL if(!feature_roots) { validateModes(); feature_roots = new QStringList(qmake_feature_paths(prop)); - qmakeAddCacheClear(qmakeDeleteCacheClear_QStringList, (void**)&feature_roots); + qmakeAddCacheClear(qmakeDeleteCacheClear<QStringList>, (void**)&feature_roots); } debug_msg(2, "Looking for feature '%s' in (%s)", file.toLatin1().constData(), feature_roots->join("::").toLatin1().constData()); |