[LyX/master] Do not pass list of columns parameter by value

Jean-Marc Lasgouttes lasgouttes at lyx.org
Fri Jan 12 09:55:36 UTC 2024


commit 952851a9bcbe6801e73aacc86de0b40bab7d192b
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Fri Jan 12 12:16:31 2024 +0100

    Do not pass list of columns parameter by value
    
    There is no need for copying this information.
    
    Noticed by coverity scan.
---
 src/insets/InsetTabular.cpp |   14 +++++++-------
 src/insets/InsetTabular.h   |   16 ++++++++--------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index 27201d2..112e806 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -2599,8 +2599,8 @@ bool Tabular::isPartOfMultiRow(row_type row, col_type column) const
 }
 
 
-void Tabular::TeXTopHLine(otexstream & os, row_type row, list<col_type> columns,
-			  list<col_type> logical_columns) const
+void Tabular::TeXTopHLine(otexstream & os, row_type row, list<col_type> const & columns,
+			  list<col_type> const & logical_columns) const
 {
 	// we only output complete row lines and the 1st row here, the rest
 	// is done in Tabular::TeXBottomHLine(...)
@@ -2716,8 +2716,8 @@ void Tabular::TeXTopHLine(otexstream & os, row_type row, list<col_type> columns,
 }
 
 
-void Tabular::TeXBottomHLine(otexstream & os, row_type row, list<col_type> columns,
-			     list<col_type> logical_columns) const
+void Tabular::TeXBottomHLine(otexstream & os, row_type row, list<col_type> const & columns,
+			     list<col_type> const & logical_columns) const
 {
 	// we output bottomlines of row r and the toplines of row r+1
 	// if the latter do not span the whole tabular
@@ -3081,8 +3081,8 @@ void Tabular::TeXCellPostamble(otexstream & os, idx_type cell,
 
 void Tabular::TeXLongtableHeaderFooter(otexstream & os,
 				       OutputParams const & runparams,
-				       list<col_type> columns,
-				       list<col_type> logical_columns) const
+				       list<col_type> const & columns,
+				       list<col_type> const & logical_columns) const
 {
 	if (!is_long_tabular)
 		return;
@@ -3164,7 +3164,7 @@ bool Tabular::isValidRow(row_type row) const
 
 void Tabular::TeXRow(otexstream & os, row_type row,
 		     OutputParams const & runparams,
-		     list<col_type> columns, list<col_type> logical_columns) const
+		     list<col_type> const & columns, list<col_type> const & logical_columns) const
 {
 	//output the top line
 	TeXTopHLine(os, row, columns, logical_columns);
diff --git a/src/insets/InsetTabular.h b/src/insets/InsetTabular.h
index 84b9ae4..4dba557 100644
--- a/src/insets/InsetTabular.h
+++ b/src/insets/InsetTabular.h
@@ -923,8 +923,8 @@ public:
 	///
 	bool isValidRow(row_type const row) const;
 	///
-	void TeXRow(otexstream &, row_type const row,
-		    OutputParams const &, std::list<col_type>, std::list<col_type>) const;
+	void TeXRow(otexstream &, row_type const row, OutputParams const &,
+	            std::list<col_type> const &, std::list<col_type> const &) const;
 
 	/// change associated Buffer
 	void setBuffer(Buffer & buffer);
@@ -982,19 +982,19 @@ private:
 	///
 	// helper function for LaTeX
 	///
-	void TeXTopHLine(otexstream &, row_type row, std::list<col_type>,
-	                 std::list<col_type>) const;
+	void TeXTopHLine(otexstream &, row_type row, std::list<col_type> const &,
+	                 std::list<col_type> const &) const;
 	///
-	void TeXBottomHLine(otexstream &, row_type row, std::list<col_type>,
-	                    std::list<col_type>) const;
+	void TeXBottomHLine(otexstream &, row_type row, std::list<col_type> const &,
+	                    std::list<col_type> const &) const;
 	///
 	void TeXCellPreamble(otexstream &, idx_type cell, bool & ismulticol, bool & ismultirow,
 	                     bool const bidi) const;
 	///
 	void TeXCellPostamble(otexstream &, idx_type cell, bool ismulticol, bool ismultirow) const;
 	///
-	void TeXLongtableHeaderFooter(otexstream &, OutputParams const &, std::list<col_type>,
-	                              std::list<col_type>) const;
+	void TeXLongtableHeaderFooter(otexstream &, OutputParams const &, std::list<col_type> const &,
+	                              std::list<col_type> const &) const;
 
 }; // Tabular
 


More information about the lyx-cvs mailing list