[LyX/master] Slightly simplify code by using for range.

Thibaut Cuvelier tcuvelier at lyx.org
Sun Feb 27 19:04:32 UTC 2022


commit 75be9b120001c1c072cc4330bc5cb0603d6c4dfb
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sun Feb 27 20:37:19 2022 +0100

    Slightly simplify code by using for range.
---
 src/support/debug.cpp |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/support/debug.cpp b/src/support/debug.cpp
index ca14220..4e2b5c0 100644
--- a/src/support/debug.cpp
+++ b/src/support/debug.cpp
@@ -98,9 +98,9 @@ Debug::Type Debug::value(int idx)
 
 string const Debug::description(Debug::Type val)
 {
-	for (int i = 0 ; i < numErrorTags ; ++i) {
-		if (errorTags[i].level == val)
-			return errorTags[i].desc;
+	for (const auto & errorTag : errorTags) {
+		if (errorTag.level == val)
+			return errorTag.desc;
 	}
 	return "unknown level";
 }
@@ -108,9 +108,9 @@ string const Debug::description(Debug::Type val)
 
 string const Debug::name(Debug::Type val)
 {
-	for (int i = 0 ; i < numErrorTags ; ++i) {
-		if (errorTags[i].level == val)
-			return errorTags[i].name;
+	for (const auto & errorTag : errorTags) {
+		if (errorTag.level == val)
+			return errorTag.name;
 	}
 	return "unknown level";
 }


More information about the lyx-cvs mailing list