[LyX/master] Move defaults into struct definition

Richard Kimberly Heck rikiheck at lyx.org
Tue Sep 29 01:41:46 UTC 2020


commit 54a72663aef2b780b6283dadc63e3e8eca47a7a6
Author: Richard Kimberly Heck <rikiheck at lyx.org>
Date:   Mon Sep 28 21:30:40 2020 -0400

    Move defaults into struct definition
---
 src/Layout.cpp |   11 -----------
 src/Layout.h   |   20 ++++++++++----------
 2 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/src/Layout.cpp b/src/Layout.cpp
index f5e6f77..6b591ec 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -1151,19 +1151,8 @@ void Layout::readSpacing(Lexer & lex)
 void Layout::readArgument(Lexer & lex)
 {
 	latexarg arg;
-	// writeArgument() makes use of these default values
-	arg.mandatory = false;
-	arg.nodelims = false;
-	arg.autoinsert = false;
-	arg.insertcotext = false;
-	arg.insertonnewline = false;
 	bool error = false;
 	bool finished = false;
-	arg.font = inherit_font;
-	arg.labelfont = inherit_font;
-	arg.is_toc_caption = false;
-	arg.passthru = PT_INHERITED;
-	arg.free_spacing = false;
 	string id;
 	lex >> id;
 	bool const itemarg = prefixIs(id, "item:");
diff --git a/src/Layout.h b/src/Layout.h
index 14784a2..590c52d 100644
--- a/src/Layout.h
+++ b/src/Layout.h
@@ -93,8 +93,8 @@ public:
 	struct latexarg {
 		docstring labelstring;
 		docstring menustring;
-		bool mandatory;
-		bool nodelims;
+		bool mandatory = false;
+		bool nodelims = false;
 		docstring ldelim;
 		docstring rdelim;
 		docstring defaultarg;
@@ -102,15 +102,15 @@ public:
 		docstring tooltip;
 		std::string required;
 		std::string decoration;
-		FontInfo font;
-		FontInfo labelfont;
-		bool autoinsert;
-		bool insertcotext;
-		bool insertonnewline;
-		ArgPassThru passthru;
+		FontInfo font = inherit_font;
+		FontInfo labelfont = inherit_font;
+		bool autoinsert = false;
+		bool insertcotext = false;
+		bool insertonnewline = false;
+		ArgPassThru passthru = PT_INHERITED;
 		docstring pass_thru_chars;
-		bool is_toc_caption;
-		bool free_spacing;
+		bool is_toc_caption = false;
+		bool free_spacing = false;
 		std::string newlinecmd;
 	};
 	///


More information about the lyx-cvs mailing list