prune pointless assignments of QString::replace() and remove() results
they operate in-place. Change-Id: Iab6f2f6a9f6f67b9d70feb77ec719e424909022d Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
parent
2b31356ac9
commit
aa30f49d6a
@ -880,10 +880,10 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
|
|||||||
QString librarySuffix = project->first("QMAKE_XCODE_LIBRARY_SUFFIX").toQString();
|
QString librarySuffix = project->first("QMAKE_XCODE_LIBRARY_SUFFIX").toQString();
|
||||||
suffixSetting = "$(" + suffixSetting + ")";
|
suffixSetting = "$(" + suffixSetting + ")";
|
||||||
if (!librarySuffix.isEmpty()) {
|
if (!librarySuffix.isEmpty()) {
|
||||||
library = library.replace(librarySuffix, suffixSetting);
|
library.replace(librarySuffix, suffixSetting);
|
||||||
name = name.remove(librarySuffix);
|
name.remove(librarySuffix);
|
||||||
} else {
|
} else {
|
||||||
library = library.replace(name, name + suffixSetting);
|
library.replace(name, name + suffixSetting);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1416,22 +1416,21 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
|
|||||||
if (plist_in_file.open(QIODevice::ReadOnly)) {
|
if (plist_in_file.open(QIODevice::ReadOnly)) {
|
||||||
QTextStream plist_in(&plist_in_file);
|
QTextStream plist_in(&plist_in_file);
|
||||||
QString plist_in_text = plist_in.readAll();
|
QString plist_in_text = plist_in.readAll();
|
||||||
plist_in_text = plist_in_text.replace("@ICON@",
|
plist_in_text.replace("@ICON@",
|
||||||
(project->isEmpty("ICON") ? QString("") : project->first("ICON").toQString().section(Option::dir_sep, -1)));
|
(project->isEmpty("ICON") ? QString("") : project->first("ICON").toQString().section(Option::dir_sep, -1)));
|
||||||
if (project->first("TEMPLATE") == "app") {
|
if (project->first("TEMPLATE") == "app") {
|
||||||
plist_in_text = plist_in_text.replace("@EXECUTABLE@", project->first("QMAKE_ORIG_TARGET").toQString());
|
plist_in_text.replace("@EXECUTABLE@", project->first("QMAKE_ORIG_TARGET").toQString());
|
||||||
} else {
|
} else {
|
||||||
plist_in_text = plist_in_text.replace("@LIBRARY@", project->first("QMAKE_ORIG_TARGET").toQString());
|
plist_in_text.replace("@LIBRARY@", project->first("QMAKE_ORIG_TARGET").toQString());
|
||||||
}
|
}
|
||||||
QString bundlePrefix = project->first("QMAKE_TARGET_BUNDLE_PREFIX").toQString();
|
QString bundlePrefix = project->first("QMAKE_TARGET_BUNDLE_PREFIX").toQString();
|
||||||
if (bundlePrefix.isEmpty())
|
if (bundlePrefix.isEmpty())
|
||||||
bundlePrefix = "com.yourcompany";
|
bundlePrefix = "com.yourcompany";
|
||||||
plist_in_text = plist_in_text.replace("@BUNDLEIDENTIFIER@", bundlePrefix + "." + QLatin1String("${PRODUCT_NAME:rfc1034identifier}"));
|
plist_in_text.replace("@BUNDLEIDENTIFIER@", bundlePrefix + '.' + QLatin1String("${PRODUCT_NAME:rfc1034identifier}"));
|
||||||
if (!project->values("VERSION").isEmpty()) {
|
if (!project->values("VERSION").isEmpty()) {
|
||||||
plist_in_text = plist_in_text.replace("@SHORT_VERSION@", project->first("VER_MAJ") + "." +
|
plist_in_text.replace("@SHORT_VERSION@", project->first("VER_MAJ") + "." + project->first("VER_MIN"));
|
||||||
project->first("VER_MIN"));
|
|
||||||
}
|
}
|
||||||
plist_in_text = plist_in_text.replace("@TYPEINFO@",
|
plist_in_text.replace("@TYPEINFO@",
|
||||||
(project->isEmpty("QMAKE_PKGINFO_TYPEINFO")
|
(project->isEmpty("QMAKE_PKGINFO_TYPEINFO")
|
||||||
? QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4).toQString()));
|
? QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4).toQString()));
|
||||||
QFile plist_out_file("Info.plist");
|
QFile plist_out_file("Info.plist");
|
||||||
@ -1746,7 +1745,7 @@ ProjectBuilderMakefileGenerator::pbuilderVersion() const
|
|||||||
version_plist = "/Developer/Applications/Project Builder.app/Contents/version.plist";
|
version_plist = "/Developer/Applications/Project Builder.app/Contents/version.plist";
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
version_plist = version_plist.replace(QRegExp("\""), "");
|
version_plist.replace(QRegExp("\""), "");
|
||||||
}
|
}
|
||||||
if (ret.isEmpty()) {
|
if (ret.isEmpty()) {
|
||||||
QFile version_file(version_plist);
|
QFile version_file(version_plist);
|
||||||
|
@ -2280,7 +2280,7 @@ MakefileGenerator::findSubDirsSubTargets() const
|
|||||||
ProString ofile = subdirs[subdir];
|
ProString ofile = subdirs[subdir];
|
||||||
QString oname = ofile.toQString();
|
QString oname = ofile.toQString();
|
||||||
QString fixedSubdir = oname;
|
QString fixedSubdir = oname;
|
||||||
fixedSubdir = fixedSubdir.replace(QRegExp("[^a-zA-Z0-9_]"),"-");
|
fixedSubdir.replace(QRegExp("[^a-zA-Z0-9_]"),"-");
|
||||||
|
|
||||||
SubTarget *st = new SubTarget;
|
SubTarget *st = new SubTarget;
|
||||||
st->name = oname;
|
st->name = oname;
|
||||||
@ -2345,7 +2345,7 @@ MakefileGenerator::findSubDirsSubTargets() const
|
|||||||
if(subdirs[subDep] == depends.at(depend)) {
|
if(subdirs[subDep] == depends.at(depend)) {
|
||||||
QString subName = subdirs[subDep].toQString();
|
QString subName = subdirs[subDep].toQString();
|
||||||
QString fixedSubDep = subName;
|
QString fixedSubDep = subName;
|
||||||
fixedSubDep = fixedSubDep.replace(QRegExp("[^a-zA-Z0-9_]"),"-");
|
fixedSubDep.replace(QRegExp("[^a-zA-Z0-9_]"),"-");
|
||||||
const ProKey dtkey(fixedSubDep + ".target");
|
const ProKey dtkey(fixedSubDep + ".target");
|
||||||
if (!project->isEmpty(dtkey)) {
|
if (!project->isEmpty(dtkey)) {
|
||||||
st->depends += project->first(dtkey);
|
st->depends += project->first(dtkey);
|
||||||
@ -2376,7 +2376,7 @@ MakefileGenerator::findSubDirsSubTargets() const
|
|||||||
st->target = project->first(tkey).toQString();
|
st->target = project->first(tkey).toQString();
|
||||||
} else {
|
} else {
|
||||||
st->target = "sub-" + file;
|
st->target = "sub-" + file;
|
||||||
st->target = st->target.replace(QRegExp("[^a-zA-Z0-9_]"),"-");
|
st->target.replace(QRegExp("[^a-zA-Z0-9_]"), "-");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3146,7 +3146,7 @@ MakefileGenerator::pkgConfigFixPath(QString path) const
|
|||||||
{
|
{
|
||||||
QString prefix = pkgConfigPrefix();
|
QString prefix = pkgConfigPrefix();
|
||||||
if(path.startsWith(prefix))
|
if(path.startsWith(prefix))
|
||||||
path = path.replace(prefix, "${prefix}");
|
path.replace(prefix, "${prefix}");
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ ProjectGenerator::fixPathToQmake(const QString &file)
|
|||||||
{
|
{
|
||||||
QString ret = file;
|
QString ret = file;
|
||||||
if(Option::dir_sep != QLatin1String("/"))
|
if(Option::dir_sep != QLatin1String("/"))
|
||||||
ret = ret.replace(Option::dir_sep, QLatin1String("/"));
|
ret.replace(Option::dir_sep, QLatin1String("/"));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,13 +194,11 @@ UnixMakefileGenerator::init()
|
|||||||
pchBaseName += project->first("QMAKE_ORIG_TARGET").toQString();
|
pchBaseName += project->first("QMAKE_ORIG_TARGET").toQString();
|
||||||
|
|
||||||
// replace place holders
|
// replace place holders
|
||||||
pchFlags = pchFlags.replace("${QMAKE_PCH_INPUT}",
|
pchFlags.replace("${QMAKE_PCH_INPUT}", project->first("PRECOMPILED_HEADER").toQString());
|
||||||
project->first("PRECOMPILED_HEADER").toQString());
|
pchFlags.replace("${QMAKE_PCH_OUTPUT_BASE}", pchBaseName);
|
||||||
pchFlags = pchFlags.replace("${QMAKE_PCH_OUTPUT_BASE}", pchBaseName);
|
|
||||||
if (project->isActiveConfig("icc_pch_style")) {
|
if (project->isActiveConfig("icc_pch_style")) {
|
||||||
// icc style
|
// icc style
|
||||||
pchFlags = pchFlags.replace("${QMAKE_PCH_OUTPUT}",
|
pchFlags.replace("${QMAKE_PCH_OUTPUT}", pchBaseName + project->first("QMAKE_PCH_OUTPUT_EXT"));
|
||||||
pchBaseName + project->first("QMAKE_PCH_OUTPUT_EXT"));
|
|
||||||
} else {
|
} else {
|
||||||
// gcc style (including clang_pch_style)
|
// gcc style (including clang_pch_style)
|
||||||
QString headerSuffix;
|
QString headerSuffix;
|
||||||
@ -224,8 +222,7 @@ UnixMakefileGenerator::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!pchOutputFile.isEmpty()) {
|
if(!pchOutputFile.isEmpty()) {
|
||||||
pchFlags = pchFlags.replace("${QMAKE_PCH_OUTPUT}",
|
pchFlags.replace("${QMAKE_PCH_OUTPUT}", pchBaseName + pchOutputFile + headerSuffix);
|
||||||
pchBaseName + pchOutputFile + headerSuffix);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -714,7 +714,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
|||||||
t << destdir << "$(TARGET): " << var("PRE_TARGETDEPS")
|
t << destdir << "$(TARGET): " << var("PRE_TARGETDEPS")
|
||||||
<< " " << var("POST_TARGETDEPS") << valList(build) << "\n\t";
|
<< " " << var("POST_TARGETDEPS") << valList(build) << "\n\t";
|
||||||
ar = project->first("QMAKE_AR_CMD").toQString();
|
ar = project->first("QMAKE_AR_CMD").toQString();
|
||||||
ar = ar.replace("$(OBJECTS)", build.join(' '));
|
ar.replace("$(OBJECTS)", build.join(' '));
|
||||||
} else {
|
} else {
|
||||||
t << (*libit) << ": " << valList(build) << "\n\t";
|
t << (*libit) << ": " << valList(build) << "\n\t";
|
||||||
ar = "$(AR) " + (*libit) + " " + build.join(' ');
|
ar = "$(AR) " + (*libit) + " " + build.join(' ');
|
||||||
@ -1075,8 +1075,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
|||||||
<< "\n\techo \"// Automatically generated, do not modify\" > " << sourceFile
|
<< "\n\techo \"// Automatically generated, do not modify\" > " << sourceFile
|
||||||
<< "\n\trm -f " << pchOutput;
|
<< "\n\trm -f " << pchOutput;
|
||||||
|
|
||||||
pchFlags = pchFlags.replace("${QMAKE_PCH_TEMP_SOURCE}", sourceFile)
|
pchFlags.replace("${QMAKE_PCH_TEMP_SOURCE}", sourceFile)
|
||||||
.replace("${QMAKE_PCH_TEMP_OBJECT}", objectFile);
|
.replace("${QMAKE_PCH_TEMP_OBJECT}", objectFile);
|
||||||
} else {
|
} else {
|
||||||
// gcc style (including clang_pch_style)
|
// gcc style (including clang_pch_style)
|
||||||
ProString header_prefix = project->first("QMAKE_PRECOMP_PREFIX");
|
ProString header_prefix = project->first("QMAKE_PRECOMP_PREFIX");
|
||||||
@ -1102,9 +1102,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
|||||||
t << pchOutput << ": " << pchInput << " " << findDependencies(pchInput).join(" \\\n\t\t")
|
t << pchOutput << ": " << pchInput << " " << findDependencies(pchInput).join(" \\\n\t\t")
|
||||||
<< "\n\t" << mkdir_p_asstring(pchOutputDir);
|
<< "\n\t" << mkdir_p_asstring(pchOutputDir);
|
||||||
}
|
}
|
||||||
pchFlags = pchFlags.replace("${QMAKE_PCH_INPUT}", pchInput)
|
pchFlags.replace("${QMAKE_PCH_INPUT}", pchInput)
|
||||||
.replace("${QMAKE_PCH_OUTPUT_BASE}", pchBaseName.toQString())
|
.replace("${QMAKE_PCH_OUTPUT_BASE}", pchBaseName.toQString())
|
||||||
.replace("${QMAKE_PCH_OUTPUT}", pchOutput.toQString());
|
.replace("${QMAKE_PCH_OUTPUT}", pchOutput.toQString());
|
||||||
|
|
||||||
QString compiler;
|
QString compiler;
|
||||||
if(comps[i] == "C" || comps[i] == "OBJC" || comps[i] == "OBJCXX")
|
if(comps[i] == "C" || comps[i] == "OBJC" || comps[i] == "OBJCXX")
|
||||||
|
@ -1693,11 +1693,11 @@ QString VcprojGenerator::fixFilename(QString ofile) const
|
|||||||
ofile = Option::fixPathToLocalOS(ofile);
|
ofile = Option::fixPathToLocalOS(ofile);
|
||||||
int slashfind = ofile.lastIndexOf(Option::dir_sep);
|
int slashfind = ofile.lastIndexOf(Option::dir_sep);
|
||||||
if(slashfind == -1) {
|
if(slashfind == -1) {
|
||||||
ofile = ofile.replace('-', '_');
|
ofile.replace('-', '_');
|
||||||
} else {
|
} else {
|
||||||
int hyphenfind = ofile.indexOf('-', slashfind);
|
int hyphenfind = ofile.indexOf('-', slashfind);
|
||||||
while (hyphenfind != -1 && slashfind < hyphenfind) {
|
while (hyphenfind != -1 && slashfind < hyphenfind) {
|
||||||
ofile = ofile.replace(hyphenfind, 1, '_');
|
ofile.replace(hyphenfind, 1, '_');
|
||||||
hyphenfind = ofile.indexOf('-', hyphenfind + 1);
|
hyphenfind = ofile.indexOf('-', hyphenfind + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -530,15 +530,15 @@ Option::fixString(QString string, uchar flags)
|
|||||||
|
|
||||||
//fix separators
|
//fix separators
|
||||||
if (flags & Option::FixPathToNormalSeparators) {
|
if (flags & Option::FixPathToNormalSeparators) {
|
||||||
string = string.replace('\\', '/');
|
string.replace('\\', '/');
|
||||||
} else if (flags & Option::FixPathToLocalSeparators) {
|
} else if (flags & Option::FixPathToLocalSeparators) {
|
||||||
#if defined(Q_OS_WIN32)
|
#if defined(Q_OS_WIN32)
|
||||||
string = string.replace('/', '\\');
|
string.replace('/', '\\');
|
||||||
#else
|
#else
|
||||||
string = string.replace('\\', '/');
|
string.replace('\\', '/');
|
||||||
#endif
|
#endif
|
||||||
} else if(flags & Option::FixPathToTargetSeparators) {
|
} else if(flags & Option::FixPathToTargetSeparators) {
|
||||||
string = string.replace('/', Option::dir_sep).replace('\\', Option::dir_sep);
|
string.replace('/', Option::dir_sep).replace('\\', Option::dir_sep);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((string.startsWith("\"") && string.endsWith("\"")) ||
|
if ((string.startsWith("\"") && string.endsWith("\"")) ||
|
||||||
|
Loading…
x
Reference in New Issue
Block a user