From 103e0f9913655a803e46f37e17574c1441c795d4 Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 12 May 2017 11:01:03 +1000 Subject: Replace intrusive linked lists with vector and unique_ptr to simplify code. Remove LexerMinder as not needed. --- src/ExternalLexer.h | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) (limited to 'src/ExternalLexer.h') diff --git a/src/ExternalLexer.h b/src/ExternalLexer.h index a85213e31..7804c19f0 100644 --- a/src/ExternalLexer.h +++ b/src/ExternalLexer.h @@ -38,26 +38,15 @@ public: virtual void SetExternal(GetLexerFactoryFunction fFactory, int index); }; -/// LexerMinder points to an ExternalLexerModule - so we don't leak them. -class LexerMinder { -public: - ExternalLexerModule *self; - LexerMinder *next; -}; - -/// LexerLibrary exists for every External Lexer DLL, contains LexerMinders. +/// LexerLibrary exists for every External Lexer DLL, contains ExternalLexerModules. class LexerLibrary { - DynamicLibrary *lib; - LexerMinder *first; - LexerMinder *last; - + std::unique_ptr lib; + std::vector> modules; public: - explicit LexerLibrary(const char *ModuleName); + explicit LexerLibrary(const char *moduleName_); ~LexerLibrary(); - void Release(); - LexerLibrary *next; - std::string m_sModuleName; + std::string moduleName; }; /// LexerManager manages external lexers, contains LexerLibrarys. @@ -73,11 +62,8 @@ public: private: LexerManager(); - static LexerManager *theInstance; - - void LoadLexerLibrary(const char *module); - LexerLibrary *first; - LexerLibrary *last; + static std::unique_ptr theInstance; + std::vector> libraries; }; class LMMinder { -- cgit v1.2.3