[LyX/master] Pass a two parameters parameter by reference

Jean-Marc Lasgouttes lasgouttes at lyx.org
Fri Jan 12 13:29:13 UTC 2024


commit 1599c503df11b0c73b60e5c239f3cde9dcf73801
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Fri Jan 12 15:28:39 2024 +0100

    Pass a two parameters parameter by reference
    
    Note that there is also a vector parameter that is passed by value.
    However it is modified as a local copy and I do not want to change
    this now.
    
    Spotted by coverity.
---
 src/output_latex.cpp |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/output_latex.cpp b/src/output_latex.cpp
index 990ff4a..5ec6a53 100644
--- a/src/output_latex.cpp
+++ b/src/output_latex.cpp
@@ -494,8 +494,13 @@ void TeXEnvironment(Buffer const & buf, Text const & text,
 }
 
 
-void getArgInsets(otexstream & os, OutputParams const & runparams, Layout::LaTeXArgMap const & latexargs,
-		  map<size_t, lyx::InsetArgument const *> ilist, vector<string> required, string const & prefix)
+// FIXME: pass the \c required vector by reference and add the stuff
+// from \c latexargs to a different vector. This avoids a copy and
+// (more importantly?) a coverity defect.
+void getArgInsets(otexstream & os, OutputParams const & runparams,
+                  Layout::LaTeXArgMap const & latexargs,
+                  map<size_t, lyx::InsetArgument const *> const & ilist,
+                  vector<string> required, string const & prefix)
 {
 	size_t const argnr = latexargs.size();
 	if (argnr == 0)


More information about the lyx-cvs mailing list