From 04703167580975a620bf7ecb256d2d3baae2f3fd Mon Sep 17 00:00:00 2001 From: Alessandro Portale <alessandro.portale@nokia.com> Date: Sun, 4 Jul 2010 09:51:38 +0200 Subject: [PATCH] Let the computer count the number of variables[] and functions[] I did not learn to count higher than 20, myself. --- src/plugins/qt4projectmanager/profilehighlighter.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/plugins/qt4projectmanager/profilehighlighter.cpp b/src/plugins/qt4projectmanager/profilehighlighter.cpp index 7fc11fbcd45..9da8a8d897c 100644 --- a/src/plugins/qt4projectmanager/profilehighlighter.cpp +++ b/src/plugins/qt4projectmanager/profilehighlighter.cpp @@ -36,8 +36,7 @@ using namespace Qt4ProjectManager::Internal; -#define MAX_VARIABLES 60 -const char *const variables[MAX_VARIABLES] = { +const char *const variables[] = { "CCFLAG", "CONFIG", "DEFINES", @@ -100,8 +99,7 @@ const char *const variables[MAX_VARIABLES] = { 0 }; -#define MAX_FUNCTIONS 22 -const char *const functions[MAX_FUNCTIONS] = { +const char *const functions[] = { "basename", "CONFIG", "contains", @@ -145,7 +143,7 @@ static bool operator<(const char *kw, const KeywordHelper &helper) static bool isVariable(const QString &word) { const char *const *start = &variables[0]; - const char *const *end = &variables[MAX_VARIABLES - 1]; + const char *const *end = &variables[sizeof variables / sizeof variables[0] - 1]; const char *const *kw = qBinaryFind(start, end, KeywordHelper(word)); return *kw != 0; } @@ -153,7 +151,7 @@ static bool isVariable(const QString &word) static bool isFunction(const QString &word) { const char *const *start = &functions[0]; - const char *const *end = &functions[MAX_FUNCTIONS - 1]; + const char *const *end = &functions[sizeof functions / sizeof functions[0] - 1]; const char *const *kw = qBinaryFind(start, end, KeywordHelper(word)); return *kw != 0; } -- GitLab