[LyX/master] Avoid an unnecessary string copy

Jean-Marc Lasgouttes lasgouttes at lyx.org
Wed Sep 11 15:09:53 UTC 2024


commit 851e59cd2657a73a5fd376d01ce2d1dfc336fe23
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Wed Sep 11 17:08:45 2024 +0200

    Avoid an unnecessary string copy
    
    Spotted by Coverity scan.
---
 src/LyXVC.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/LyXVC.cpp b/src/LyXVC.cpp
index 7e7e770b10..916ba60ac7 100644
--- a/src/LyXVC.cpp
+++ b/src/LyXVC.cpp
@@ -245,14 +245,13 @@ LyXVC::CommandResult LyXVC::checkIn(string & log)
 	LYXERR(Debug::LYXVC, "LyXVC: checkIn");
 	if (!vcs_)
 		return ErrorBefore;
-	docstring empty(_("(no log message)"));
 	docstring response;
 	bool ok = true;
 	if (vcs_->isCheckInWithConfirmation())
 		ok = Alert::askForText(response, _("LyX VC: Log Message"));
 	if (ok) {
 		if (response.empty())
-			response = empty;
+			response = _("(no log message)");
 		//shell collisions
 		response = subst(response, from_ascii("\""), from_ascii("\\\""));
 		return vcs_->checkIn(to_utf8(response), log);


More information about the lyx-cvs mailing list