From 4815f1cda42010659370ce2b80739a14d46ad21b Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 15 Dec 2015 16:56:09 +0100 Subject: qmake: Combine two variables into an array to simplify a loop. Change-Id: If787ed4a72c5fb91bb4a9e908ab3f6443b9358b9 Reviewed-by: Oswald Buddenhagen --- qmake/generators/makefiledeps.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'qmake/generators') diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp index 1f94a53c81..047d17f18a 100644 --- a/qmake/generators/makefiledeps.cpp +++ b/qmake/generators/makefiledeps.cpp @@ -898,7 +898,7 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file) debug_msg(2, "findMocs: %s", file->file.local().toLatin1().constData()); int line_count = 1; - bool ignore_qobject = false, ignore_qgadget = false; + bool ignore[2] = { false, false }; // [0] for Q_OBJECT, [1] for Q_GADGET /* qmake ignore Q_GADGET */ /* qmake ignore Q_OBJECT */ for(int x = 0; x < buffer_len; x++) { @@ -926,13 +926,13 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file) debug_msg(2, "Mocgen: %s:%d Found \"qmake ignore Q_OBJECT\"", file->file.real().toLatin1().constData(), line_count); x += 20; - ignore_qobject = true; + ignore[0] = true; } else if(buffer_len >= (x + 20) && !strncmp(buffer + x + 1, "make ignore Q_GADGET", 20)) { debug_msg(2, "Mocgen: %s:%d Found \"qmake ignore Q_GADGET\"", file->file.real().toLatin1().constData(), line_count); x += 20; - ignore_qgadget = true; + ignore[1] = true; } } else if (buffer[x] == '*') { extralines = 0; @@ -962,10 +962,8 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file) if (buffer[y] == 'Q') { static const char interesting[][9] = { "Q_OBJECT", "Q_GADGET" }; for (int interest = 0; interest < 2; ++interest) { - if(interest == 0 && ignore_qobject) - continue; - else if(interest == 1 && ignore_qgadget) - continue; + if (ignore[interest]) + continue; int matchlen = 0, extralines = 0; if (matchWhileUnsplitting(buffer, buffer_len, y, -- cgit v1.2.3