diff options
author | Tian Shilin <[email protected]> | 2024-08-22 13:53:26 +0800 |
---|---|---|
committer | Tian Shilin <[email protected]> | 2024-08-29 01:01:40 +0800 |
commit | 65fecd0c47d6ff39e8a728b0c6538d44f3aa00aa (patch) | |
tree | 524e6fa560cddc55e283985a57cec00ac7795478 /src/gui/text/qtextdocument_p.cpp | |
parent | 0dd5b2de4c59e2f0175aba3cf720a47998108330 (diff) |
fix: Redundant condition in qtextdocument
Q_ASSERT(n || (!n && block_pos == blocks.length()))
contains a redundant conditional check,when n is true,the
conditional judgment must be true,when n is false,whether
the conditional judgment is true or not depends entirely
on block_pos == blocks.length( ), ā!nā is not necessary.
eg: 'A || (!A && B)' is equivalent to 'A || B'.
Change-Id: Ia1c2df548d97db92a4fa1089e3f5a79e45800829
Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]>
Diffstat (limited to 'src/gui/text/qtextdocument_p.cpp')
-rw-r--r-- | src/gui/text/qtextdocument_p.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index 9ccd01edb0d..227cbae2952 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -335,7 +335,7 @@ int QTextDocumentPrivate::insert_block(int pos, uint strPos, int format, int blo int n = blocks.findNode(block_pos); int key = n ? blocks.position(n) : blocks.length(); - Q_ASSERT(n || (!n && block_pos == blocks.length())); + Q_ASSERT(n || block_pos == blocks.length()); if (key != block_pos) { Q_ASSERT(key < block_pos); int oldSize = blocks.size(n); |