Skip to content

Commit 28fc7d1

Browse files
committed
Refactoring: changed Doxygen::expandAsDefinedDict to Doxygen::expandAsDefinedSet
1 parent f3ebc86 commit 28fc7d1

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

src/doxygen.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ FileNameLinkedMap *Doxygen::mscFileNameLinkedMap = 0; // msc files
136136
FileNameLinkedMap *Doxygen::diaFileNameLinkedMap = 0; // dia files
137137
StringDict Doxygen::namespaceAliasDict(257); // all namespace aliases
138138
StringDict Doxygen::tagDestinationDict(257); // all tag locations
139-
QDict<void> Doxygen::expandAsDefinedDict(257); // all macros that should be expanded
139+
std::unordered_set<std::string> Doxygen::expandAsDefinedSet; // all macros that should be expanded
140140
QIntDict<MemberGroupInfo> Doxygen::memGrpInfoDict(1009); // dictionary of the member groups heading
141141
PageDef *Doxygen::mainPage = 0;
142142
bool Doxygen::insideMainPage = FALSE; // are we generating docs for the main page?
@@ -275,8 +275,6 @@ void statistics()
275275
Doxygen::tagDestinationDict.statistics();
276276
fprintf(stderr,"--- g_compoundKeywordDict stats ----\n");
277277
g_compoundKeywordDict.statistics();
278-
fprintf(stderr,"--- expandAsDefinedDict stats ----\n");
279-
Doxygen::expandAsDefinedDict.statistics();
280278
fprintf(stderr,"--- memGrpInfoDict stats ----\n");
281279
Doxygen::memGrpInfoDict.statistics();
282280
}
@@ -10311,10 +10309,7 @@ void adjustConfiguration()
1031110309
s=expandAsDefinedList.first();
1031210310
while (s)
1031310311
{
10314-
if (Doxygen::expandAsDefinedDict[s]==0)
10315-
{
10316-
Doxygen::expandAsDefinedDict.insert(s,(void *)666);
10317-
}
10312+
Doxygen::expandAsDefinedSet.insert(s);
1031810313
s=expandAsDefinedList.next();
1031910314
}
1032010315

src/doxygen.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include <qdict.h>
2323
#include <qintdict.h>
2424

25+
#include <unordered_set>
26+
2527
#include "ftextstream.h"
2628
#include "sortdict.h"
2729
#include "membergroup.h"
@@ -114,7 +116,7 @@ class Doxygen
114116
static StringDict tagDestinationDict;
115117
static StringDict aliasDict;
116118
static QIntDict<MemberGroupInfo> memGrpInfoDict;
117-
static QDict<void> expandAsDefinedDict;
119+
static std::unordered_set<std::string> expandAsDefinedSet;
118120
static NamespaceDef *globalScope;
119121
static QCString htmlFileExtension;
120122
static bool parseSourcesNeeded;

src/pre.l

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <deque>
3131
#include <algorithm>
3232
#include <set>
33+
#include <unordered_set>
3334
#include <string>
3435
#include <map>
3536
#include <utility>
@@ -334,7 +335,7 @@ void DefineManager::DefinesPerFile::collectDefines(
334335
*
335336
* global state
336337
*/
337-
static std::set<std::string> g_allIncludes;
338+
static std::unordered_set<std::string> g_allIncludes;
338339
static DefineManager g_defineManager;
339340

340341

@@ -396,7 +397,7 @@ struct preYY_state
396397
std::stack< std::unique_ptr<CondCtx> > condStack;
397398
std::deque< std::unique_ptr<FileState> > includeStack;
398399
std::map<std::string,Define*> expandedDict;
399-
std::set<std::string> expanded;
400+
std::unordered_set<std::string> expanded;
400401
ConstExpressionParser constExpParser;
401402
};
402403

@@ -2781,7 +2782,8 @@ static std::unique_ptr<Define> newDefine(yyscan_t yyscanner)
27812782
//printf("newDefine: %s %s file: %s\n",def->name.data(),def->definition.data(),
27822783
// def->fileDef ? def->fileDef->name().data() : def->fileName.data());
27832784
//printf("newDefine: '%s'->'%s'\n",def->name.data(),def->definition.data());
2784-
if (!def->name.isEmpty() && Doxygen::expandAsDefinedDict[def->name])
2785+
if (!def->name.isEmpty() &&
2786+
Doxygen::expandAsDefinedSet.find(def->name.data())!=Doxygen::expandAsDefinedSet.end())
27852787
{
27862788
def->isPredefined=TRUE;
27872789
}

0 commit comments

Comments
 (0)