From 8352a2d12fdccaff66ac565892f536757654c747 Mon Sep 17 00:00:00 2001 From: Alex Turbov Date: Mon, 18 Nov 2024 03:56:51 +0400 Subject: [PATCH] cmFileCommand.cxx: Optimize `cmStrCat()` calls --- Source/cmFileCommand.cxx | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index c5b1fe1d32..99dc7efd7b 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -1104,7 +1104,7 @@ bool HandleRPathChangeCommand(std::vector const& args, if (!cmSystemTools::ChangeRPath(file, *oldRPath, *newRPath, removeEnvironmentRPath, &emsg, &changed)) { status.SetError(cmStrCat("RPATH_CHANGE could not write new RPATH:\n ", - *newRPath, "\nto the file:\n ", file, "\n", + *newRPath, "\nto the file:\n ", file, '\n', emsg)); success = false; } @@ -1159,7 +1159,7 @@ bool HandleRPathSetCommand(std::vector const& args, if (!cmSystemTools::SetRPath(file, *newRPath, &emsg, &changed)) { status.SetError(cmStrCat("RPATH_SET could not write new RPATH:\n ", - *newRPath, "\nto the file:\n ", file, "\n", + *newRPath, "\nto the file:\n ", file, '\n', emsg)); success = false; } @@ -1209,7 +1209,7 @@ bool HandleRPathRemoveCommand(std::vector const& args, if (!cmSystemTools::RemoveRPath(file, &emsg, &removed)) { status.SetError( cmStrCat("RPATH_REMOVE could not remove RPATH from file: \n ", file, - "\n", emsg)); + '\n', emsg)); success = false; } if (success) { @@ -1538,7 +1538,7 @@ bool HandleRename(std::vector const& args, break; } status.SetError(cmStrCat("RENAME failed to rename\n ", oldname, "\nto\n ", - newname, "\nbecause: ", err, "\n")); + newname, "\nbecause: ", err, '\n')); return false; } @@ -1631,7 +1631,7 @@ bool HandleCopyFile(std::vector const& args, status.GetMakefile().AddDefinition(arguments.Result, err); } else { status.SetError(cmStrCat("COPY_FILE failed to copy\n ", oldname, - "\nto\n ", newname, "\nbecause: ", err, "\n")); + "\nto\n ", newname, "\nbecause: ", err, '\n')); result = false; } } @@ -1822,7 +1822,7 @@ public: if (updated) { status = - cmStrCat("[", this->Text, " ", this->CurrentPercentage, "% complete]"); + cmStrCat('[', this->Text, ' ', this->CurrentPercentage, "% complete]"); } return updated; @@ -2334,7 +2334,7 @@ bool HandleDownloadCommand(std::vector const& args, "set environment variable CMAKE_TLS_VERIFY=0 to suppress it."); } status.GetMakefile().AddDefinition( - statusVar, cmStrCat(static_cast(res), ";\"", std::move(m), "\"")); + statusVar, cmStrCat(static_cast(res), ";\"", std::move(m), '"')); } ::curl_global_cleanup(); @@ -2735,7 +2735,7 @@ bool HandleUploadCommand(std::vector const& args, "set environment variable CMAKE_TLS_VERIFY=0 to suppress it."); } status.GetMakefile().AddDefinition( - statusVar, cmStrCat(static_cast(res), ";\"", std::move(m), "\"")); + statusVar, cmStrCat(static_cast(res), ";\"", std::move(m), '"')); } ::curl_global_cleanup(); @@ -3090,7 +3090,7 @@ bool HandleLockCommand(std::vector const& args, if (resultVariable.empty() && !fileLockResult.IsOk()) { status.GetMakefile().IssueMessage( MessageType::FATAL_ERROR, - cmStrCat("error locking file\n \"", path, "\"\n", result, ".")); + cmStrCat("error locking file\n \"", path, "\"\n", result, '.')); cmSystemTools::SetFatalErrorOccurred(); return false; } @@ -3339,7 +3339,7 @@ bool HandleGetRuntimeDependenciesCommand(std::vector const& args, platform)) { status.SetError( cmStrCat("GET_RUNTIME_DEPENDENCIES is not supported on system \"", - platform, "\"")); + platform, '"')); cmSystemTools::SetFatalErrorOccurred(); return false; } @@ -3406,7 +3406,7 @@ bool HandleGetRuntimeDependenciesCommand(std::vector const& args, parser.Parse(cmMakeRange(args).advance(1), &unrecognizedArguments); auto argIt = unrecognizedArguments.begin(); if (argIt != unrecognizedArguments.end()) { - status.SetError(cmStrCat("Unrecognized argument: \"", *argIt, "\"")); + status.SetError(cmStrCat("Unrecognized argument: \"", *argIt, '"')); cmSystemTools::SetFatalErrorOccurred(); return false; } @@ -3538,7 +3538,7 @@ bool HandleConfigureCommand(std::vector const& args, auto argIt = unrecognizedArguments.begin(); if (argIt != unrecognizedArguments.end()) { status.SetError( - cmStrCat("CONFIGURE Unrecognized argument: \"", *argIt, "\"")); + cmStrCat("CONFIGURE Unrecognized argument: \"", *argIt, '"')); cmSystemTools::SetFatalErrorOccurred(); return false; } @@ -3672,7 +3672,7 @@ bool HandleArchiveCreateCommand(std::vector const& args, parser.Parse(cmMakeRange(args).advance(1), &unrecognizedArguments); auto argIt = unrecognizedArguments.begin(); if (argIt != unrecognizedArguments.end()) { - status.SetError(cmStrCat("Unrecognized argument: \"", *argIt, "\"")); + status.SetError(cmStrCat("Unrecognized argument: \"", *argIt, '"')); cmSystemTools::SetFatalErrorOccurred(); return false; } @@ -3801,7 +3801,7 @@ bool HandleArchiveExtractCommand(std::vector const& args, parser.Parse(cmMakeRange(args).advance(1), &unrecognizedArguments); auto argIt = unrecognizedArguments.begin(); if (argIt != unrecognizedArguments.end()) { - status.SetError(cmStrCat("Unrecognized argument: \"", *argIt, "\"")); + status.SetError(cmStrCat("Unrecognized argument: \"", *argIt, '"')); cmSystemTools::SetFatalErrorOccurred(); return false; } @@ -3826,7 +3826,7 @@ bool HandleArchiveExtractCommand(std::vector const& args, if (cmSystemTools::FileIsFullPath(parsedArgs.Destination)) { destDir = parsedArgs.Destination; } else { - destDir = cmStrCat(destDir, "/", parsedArgs.Destination); + destDir = cmStrCat(destDir, '/', parsedArgs.Destination); } if (!cmSystemTools::MakeDirectory(destDir)) { @@ -3837,7 +3837,7 @@ bool HandleArchiveExtractCommand(std::vector const& args, if (!cmSystemTools::FileIsFullPath(inFile)) { inFile = - cmStrCat(cmSystemTools::GetLogicalWorkingDirectory(), "/", inFile); + cmStrCat(cmSystemTools::GetLogicalWorkingDirectory(), '/', inFile); } }