[LyX/master] Do not handle special case where buffer == NULL

Jean-Marc Lasgouttes lasgouttes at lyx.org
Mon Sep 9 15:54:36 UTC 2024


Le 09/09/2024 à 16:47, Jürgen Spitzmüller a écrit :
> Am Montag, dem 09.09.2024 um 16:31 +0200 schrieb Scott Kostyshak:
>> Just out of curiosity (no I don't want to receive the scan results
>> ;)),
>> are most of these from Coverity adding new features that detect new
>> things? Or were they there before, and you are whittling down the
>> list little by little?
> 
> Often new coverity versions add new checks which in turn generate
> waggonloads of new reports, often for older code.
> 
> Sometimes it is new code.

Indeed, today I started with the 75 issues related to static 
initialization and then got lost in taking a new to older stuff.

The elephant in the room are the ~200 defects about a string that is 
copied instead of being moved. We could do them one-by-one, but I wonder 
how readable our code would become. A typical example is the recent 
e685d31 by Jürgen (below). I am even tempted to use std::move() here to 
point out that this is the standard library method and not just a 
function of our own.

JMarc


@@ -1707,7 +1707,7 @@ void BufferView::dispatch(FuncRequest const & cmd, 
DispatchResult & dr)
  			string label = dit.innerParagraph().getLabelForXRef();
  			if (!label.empty()) {
  				// if the paragraph has a label, we refer to this
-				string const arg = (type.empty()) ? label : label + " " + type;
+				string const arg = (type.empty()) ? move(label) : move(label) + " " 
+ type;
  				lyx::dispatch(FuncRequest(LFUN_REFERENCE_INSERT, arg));
  				break;



More information about the lyx-devel mailing list