From 21735f24cf05cac5ef6f94c1fe2058b6e06ae67e Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 11 Sep 2018 18:52:13 +0200 Subject: [PATCH] Simplify some #if-ery and use positive tests Two cases coincide without feature textdate, and the first falls through to the second with the feature, making it possible to simplify the #if-ery, converting its tests to positive form and skipping a duplicate case body in the process. Change-Id: I2c0ee800442474707bf8893bd72b9706fef54485 Reviewed-by: Thiago Macieira --- src/corelib/time/qdatetimeparser.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/corelib/time/qdatetimeparser.cpp b/src/corelib/time/qdatetimeparser.cpp index 6f582ed6506..0b5be978f8b 100644 --- a/src/corelib/time/qdatetimeparser.cpp +++ b/src/corelib/time/qdatetimeparser.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2021 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -718,16 +718,12 @@ int QDateTimeParser::sectionMaxSize(Section s, int count) const case DayOfWeekSectionShort: case DayOfWeekSectionLong: -#if !QT_CONFIG(textdate) - return 2; -#else +#if QT_CONFIG(textdate) mcount = 7; Q_FALLTHROUGH(); #endif case MonthSection: -#if !QT_CONFIG(textdate) - return 2; -#else +#if QT_CONFIG(textdate) if (count <= 2) return 2; @@ -743,7 +739,9 @@ int QDateTimeParser::sectionMaxSize(Section s, int count) const } return ret; } -#endif +#else + return 2; +#endif // textdate case MSecSection: return 3; case YearSection: