New Defects reported by Coverity Scan for LyX

Jean-Marc Lasgouttes lasgouttes at lyx.org
Sun Sep 29 19:47:39 UTC 2024


Le 26/09/2024 à 17:08, scan-admin at coverity.com a écrit :
> *** CID 445094:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
> /home/lasgoutt/src/lyx/coverity/lyx/src/frontends/qt/GuiBibtex.cpp: 327 in lyx::frontend::GuiBibtex::relAbsPressed()()
> 321     	for (QString s : selected_bibs_) {
> 322     		if (s == qf)
> 323     			sb << new_item;
> 324     		else
> 325     			sb << s;
> 326     	}
>>>>      CID 445094:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
>>>>      "sb" is copied in a call to copy assignment "operator =", when it could be moved instead.
> 327     	selected_bibs_ = sb;

Jürgen, it seems to me that it is possible to modify the string in place 
instead of duplicating the list. I the patch below correct? I do not 
know how to test it.

JMarc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Modify-string-list-in-place-instead-of-copying-it.patch
Type: text/x-patch
Size: 1039 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20240929/eb47feae/attachment-0001.bin>


More information about the lyx-devel mailing list