micro-optimize: use POD-initializable lists of variable names
Change-Id: I3732fef509b358949ef90002dbfc1960360afef8 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
parent
7251683085
commit
996bbcd78b
@ -278,8 +278,8 @@ GBuildMakefileGenerator::write()
|
||||
|
||||
if (project->first("TEMPLATE") == "app") {
|
||||
/* include linker flags if it's an application */
|
||||
QString src[] = { "QMAKE_LFLAGS", "QMAKE_LIBS", "LIBS", QString() };
|
||||
for (int i = 0; !src[i].isNull(); i++) {
|
||||
static const char * const src[] = { "QMAKE_LFLAGS", "QMAKE_LIBS", "LIBS", 0 };
|
||||
for (int i = 0; src[i]; i++) {
|
||||
/* skip target libraries for native tools */
|
||||
if (isnativebin && (i == 0))
|
||||
continue;
|
||||
@ -346,8 +346,8 @@ GBuildMakefileGenerator::write()
|
||||
}
|
||||
|
||||
/* source files for this project */
|
||||
QString src[] = { "HEADERS", "SOURCES", QString() };
|
||||
for (int i = 0; !src[i].isNull(); i++) {
|
||||
static const char * const src[] = { "HEADERS", "SOURCES", 0 };
|
||||
for (int i = 0; src[i]; i++) {
|
||||
const QStringList &l = project->values(src[i]);
|
||||
for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
|
||||
if ((*it).isEmpty())
|
||||
|
@ -786,8 +786,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
if(!project->isActiveConfig("staticlib")) { //DUMP LIBRARIES
|
||||
QStringList &libdirs = project->values("QMAKE_PBX_LIBPATHS"),
|
||||
&frameworkdirs = project->values("QMAKE_FRAMEWORKPATH");
|
||||
QString libs[] = { "QMAKE_LFLAGS", "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", QString() };
|
||||
for(int i = 0; !libs[i].isNull(); i++) {
|
||||
static const char * const libs[] = { "QMAKE_LFLAGS", "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
|
||||
for (int i = 0; libs[i]; i++) {
|
||||
tmp = project->values(libs[i]);
|
||||
for(int x = 0; x < tmp.count();) {
|
||||
bool remove = false;
|
||||
|
@ -222,10 +222,10 @@ MakefileGenerator::initOutPaths()
|
||||
//some builtin directories
|
||||
if(project->isEmpty("PRECOMPILED_DIR") && !project->isEmpty("OBJECTS_DIR"))
|
||||
v["PRECOMPILED_DIR"] = v["OBJECTS_DIR"];
|
||||
QString dirs[] = { QString("OBJECTS_DIR"), QString("DESTDIR"), QString("QMAKE_PKGCONFIG_DESTDIR"),
|
||||
QString("SUBLIBS_DIR"), QString("DLLDESTDIR"), QString("QMAKE_LIBTOOL_DESTDIR"),
|
||||
QString("PRECOMPILED_DIR"), QString() };
|
||||
for(int x = 0; !dirs[x].isEmpty(); x++) {
|
||||
static const char * const dirs[] = { "OBJECTS_DIR", "DESTDIR", "QMAKE_PKGCONFIG_DESTDIR",
|
||||
"SUBLIBS_DIR", "DLLDESTDIR", "QMAKE_LIBTOOL_DESTDIR",
|
||||
"PRECOMPILED_DIR", 0 };
|
||||
for (int x = 0; dirs[x]; x++) {
|
||||
if(v[dirs[x]].isEmpty())
|
||||
continue;
|
||||
const QString orig_path = v[dirs[x]].first();
|
||||
@ -247,10 +247,10 @@ MakefileGenerator::initOutPaths()
|
||||
|
||||
QString path = project->first(dirs[x]); //not to be changed any further
|
||||
path = fileFixify(path, currentDir, Option::output_dir);
|
||||
debug_msg(3, "Fixed output_dir %s (%s) into %s", dirs[x].toLatin1().constData(),
|
||||
debug_msg(3, "Fixed output_dir %s (%s) into %s", dirs[x],
|
||||
orig_path.toLatin1().constData(), path.toLatin1().constData());
|
||||
if(!mkdir(path))
|
||||
warn_msg(WarnLogic, "%s: Cannot access directory '%s'", dirs[x].toLatin1().constData(),
|
||||
warn_msg(WarnLogic, "%s: Cannot access directory '%s'", dirs[x],
|
||||
path.toLatin1().constData());
|
||||
}
|
||||
|
||||
@ -822,8 +822,8 @@ MakefileGenerator::init()
|
||||
}
|
||||
|
||||
//fix up the target deps
|
||||
QString fixpaths[] = { QString("PRE_TARGETDEPS"), QString("POST_TARGETDEPS"), QString() };
|
||||
for(int path = 0; !fixpaths[path].isNull(); path++) {
|
||||
static const char * const fixpaths[] = { "PRE_TARGETDEPS", "POST_TARGETDEPS", 0 };
|
||||
for (int path = 0; fixpaths[path]; path++) {
|
||||
QStringList &l = v[fixpaths[path]];
|
||||
for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) {
|
||||
if(!(*val_it).isEmpty())
|
||||
@ -932,7 +932,7 @@ MakefileGenerator::processPrlFile(QString &file)
|
||||
}
|
||||
|
||||
void
|
||||
MakefileGenerator::filterIncludedFiles(const QString &var)
|
||||
MakefileGenerator::filterIncludedFiles(const char *var)
|
||||
{
|
||||
QStringList &inputs = project->values(var);
|
||||
for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ) {
|
||||
@ -1115,7 +1115,7 @@ MakefileGenerator::writePrlFile()
|
||||
}
|
||||
|
||||
void
|
||||
MakefileGenerator::writeObj(QTextStream &t, const QString &src)
|
||||
MakefileGenerator::writeObj(QTextStream &t, const char *src)
|
||||
{
|
||||
const QStringList &srcl = project->values(src);
|
||||
const QStringList objl = createObjectList(srcl);
|
||||
|
@ -95,7 +95,7 @@ protected:
|
||||
QStringList createObjectList(const QStringList &sources);
|
||||
|
||||
//makefile style generator functions
|
||||
void writeObj(QTextStream &, const QString &src);
|
||||
void writeObj(QTextStream &, const char *src);
|
||||
void writeInstalls(QTextStream &t, const QString &installs, bool noBuild=false);
|
||||
void writeHeader(QTextStream &t);
|
||||
void writeSubDirs(QTextStream &t);
|
||||
@ -199,7 +199,7 @@ protected:
|
||||
virtual QStringList &findDependencies(const QString &file);
|
||||
virtual bool doDepends() const { return Option::mkfile::do_deps; }
|
||||
|
||||
void filterIncludedFiles(const QString &);
|
||||
void filterIncludedFiles(const char *);
|
||||
virtual void processSources() {
|
||||
filterIncludedFiles("SOURCES");
|
||||
filterIncludedFiles("GENERATED_SOURCES");
|
||||
|
@ -246,8 +246,8 @@ ProjectGenerator::init()
|
||||
|
||||
QStringList &h = v["HEADERS"];
|
||||
bool no_qt_files = true;
|
||||
QString srcs[] = { "SOURCES", "YACCSOURCES", "LEXSOURCES", "FORMS", QString() };
|
||||
for(int i = 0; !srcs[i].isNull(); i++) {
|
||||
static const char *srcs[] = { "SOURCES", "YACCSOURCES", "LEXSOURCES", "FORMS", 0 };
|
||||
for (int i = 0; srcs[i]; i++) {
|
||||
const QStringList &l = v[srcs[i]];
|
||||
QMakeSourceFileInfo::SourceFileType type = QMakeSourceFileInfo::TYPE_C;
|
||||
QMakeSourceFileInfo::addSourceFiles(l, QMakeSourceFileInfo::SEEK_DEPS, type);
|
||||
|
@ -344,15 +344,15 @@ UnixMakefileGenerator::init()
|
||||
}
|
||||
|
||||
if(project->isActiveConfig("compile_libtool")) {
|
||||
const QString libtoolify[] = { "QMAKE_RUN_CC", "QMAKE_RUN_CC_IMP",
|
||||
"QMAKE_RUN_CXX", "QMAKE_RUN_CXX_IMP",
|
||||
"QMAKE_LINK_THREAD", "QMAKE_LINK", "QMAKE_AR_CMD", "QMAKE_LINK_SHLIB_CMD",
|
||||
QString() };
|
||||
for(int i = 0; !libtoolify[i].isNull(); i++) {
|
||||
static const char * const libtoolify[] = {
|
||||
"QMAKE_RUN_CC", "QMAKE_RUN_CC_IMP", "QMAKE_RUN_CXX", "QMAKE_RUN_CXX_IMP",
|
||||
"QMAKE_LINK_THREAD", "QMAKE_LINK", "QMAKE_AR_CMD", "QMAKE_LINK_SHLIB_CMD", 0
|
||||
};
|
||||
for (int i = 0; libtoolify[i]; i++) {
|
||||
QStringList &l = project->values(libtoolify[i]);
|
||||
if(!l.isEmpty()) {
|
||||
QString libtool_flags, comp_flags;
|
||||
if(libtoolify[i].startsWith("QMAKE_LINK") || libtoolify[i] == "QMAKE_AR_CMD") {
|
||||
if (!strncmp(libtoolify[i], "QMAKE_LINK", 10) || !strcmp(libtoolify[i], "QMAKE_AR_CMD")) {
|
||||
libtool_flags += " --mode=link";
|
||||
if(project->isActiveConfig("staticlib")) {
|
||||
libtool_flags += " -static";
|
||||
@ -468,8 +468,8 @@ UnixMakefileGenerator::findLibraries()
|
||||
int libidx = 0;
|
||||
foreach (const QString &dlib, project->values("QMAKE_DEFAULT_LIBDIRS"))
|
||||
libdirs.append(QMakeLocalFileName(dlib));
|
||||
const QString lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", QString() };
|
||||
for(int i = 0; !lflags[i].isNull(); i++) {
|
||||
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
|
||||
for (int i = 0; lflags[i]; i++) {
|
||||
QStringList &l = project->values(lflags[i]);
|
||||
for (QStringList::Iterator it = l.begin(); it != l.end(); ) {
|
||||
QString stub, dir, extn, opt = (*it).trimmed();
|
||||
@ -574,8 +574,8 @@ UnixMakefileGenerator::processPrlFiles()
|
||||
libdirs.append(QMakeLocalFileName(dlib));
|
||||
frameworkdirs.append(QMakeLocalFileName("/System/Library/Frameworks"));
|
||||
frameworkdirs.append(QMakeLocalFileName("/Library/Frameworks"));
|
||||
const QString lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", QString() };
|
||||
for(int i = 0; !lflags[i].isNull(); i++) {
|
||||
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
|
||||
for (int i = 0; lflags[i]; i++) {
|
||||
QStringList &l = project->values(lflags[i]);
|
||||
for(int lit = 0; lit < l.size(); ++lit) {
|
||||
QString opt = l.at(lit).trimmed();
|
||||
|
@ -299,8 +299,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
t << mkdir_p_asstring("$(@D)") << "\n\t"
|
||||
<< "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl;
|
||||
|
||||
QString src[] = { "SOURCES", "GENERATED_SOURCES", QString() };
|
||||
for(int x = 0; !src[x].isNull(); x++) {
|
||||
static const char * const src[] = { "SOURCES", "GENERATED_SOURCES", 0 };
|
||||
for (int x = 0; src[x]; x++) {
|
||||
const QStringList &l = project->values(src[x]);
|
||||
for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
|
||||
if(!(*it).isEmpty()) {
|
||||
|
@ -74,8 +74,8 @@ QString MingwMakefileGenerator::getLibTarget()
|
||||
bool MingwMakefileGenerator::findLibraries()
|
||||
{
|
||||
QList<QMakeLocalFileName> dirs;
|
||||
const QString lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", QString() };
|
||||
for (int i = 0; !lflags[i].isNull(); i++) {
|
||||
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
|
||||
for (int i = 0; lflags[i]; i++) {
|
||||
QStringList &l = project->values(lflags[i]);
|
||||
QStringList::Iterator it = l.begin();
|
||||
while (it != l.end()) {
|
||||
|
@ -312,16 +312,16 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t)
|
||||
|
||||
QHash<QString, void*> source_directories;
|
||||
source_directories.insert(".", (void*)1);
|
||||
QString directories[] = { QString("UI_SOURCES_DIR"), QString("UI_DIR"), QString() };
|
||||
for(int y = 0; !directories[y].isNull(); y++) {
|
||||
static const char * const directories[] = { "UI_SOURCES_DIR", "UI_DIR", 0 };
|
||||
for (int y = 0; directories[y]; y++) {
|
||||
QString dirTemp = project->first(directories[y]);
|
||||
if (dirTemp.endsWith("\\"))
|
||||
dirTemp.truncate(dirTemp.length()-1);
|
||||
if(!dirTemp.isEmpty())
|
||||
source_directories.insert(dirTemp, (void*)1);
|
||||
}
|
||||
QString srcs[] = { QString("SOURCES"), QString("GENERATED_SOURCES"), QString() };
|
||||
for(int x = 0; !srcs[x].isNull(); x++) {
|
||||
static const char * const srcs[] = { "SOURCES", "GENERATED_SOURCES", 0 };
|
||||
for (int x = 0; srcs[x]; x++) {
|
||||
const QStringList &l = project->values(srcs[x]);
|
||||
for (QStringList::ConstIterator sit = l.begin(); sit != l.end(); ++sit) {
|
||||
QString sep = "\\";
|
||||
|
@ -107,8 +107,8 @@ bool
|
||||
Win32MakefileGenerator::findLibraries()
|
||||
{
|
||||
QList<QMakeLocalFileName> dirs;
|
||||
const QString lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", QString() };
|
||||
for (int i = 0; !lflags[i].isNull(); i++) {
|
||||
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
|
||||
for (int i = 0; lflags[i]; i++) {
|
||||
QStringList &l = project->values(lflags[i]);
|
||||
for(QStringList::Iterator it = l.begin(); it != l.end();) {
|
||||
QChar quote;
|
||||
@ -218,8 +218,8 @@ Win32MakefileGenerator::processPrlFiles()
|
||||
{
|
||||
const QString libArg = project->first("QMAKE_L_FLAG");
|
||||
QList<QMakeLocalFileName> libdirs;
|
||||
const QString lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", QString() };
|
||||
for (int i = 0; !lflags[i].isNull(); i++) {
|
||||
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
|
||||
for (int i = 0; lflags[i]; i++) {
|
||||
QStringList &l = project->values(lflags[i]);
|
||||
for (int lit = 0; lit < l.size(); ++lit) {
|
||||
QString opt = l.at(lit).trimmed();
|
||||
|
Loading…
Reference in New Issue
Block a user