summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@theqtcompany.com>2015-12-15 16:56:09 +0100
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-12-17 13:47:37 +0000
commit4815f1cda42010659370ce2b80739a14d46ad21b (patch)
treee4e5b92907fe50399e5a1ec58691beaa0c28d8f5
parentd6efc0aab30c5dc927aa8a0c743ab0c3775321a4 (diff)
qmake: Combine two variables into an array to simplify a loop.
Change-Id: If787ed4a72c5fb91bb4a9e908ab3f6443b9358b9 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
-rw-r--r--qmake/generators/makefiledeps.cpp12
1 files changed, 5 insertions, 7 deletions
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,