From c0a50bf2bd1ca7467b55e9fbed5490d82a98f696 Mon Sep 17 00:00:00 2001 From: Charl Wentzel Date: Mon, 20 May 2019 18:07:25 +0200 Subject: [PATCH] Minor update: - FunctionCore: - Set Function Type in Init() - SelectableBare: - Remove unnecesary initialisation in constructor - SelectableCore: - Remove code duplicated in SelectableBare --- ApplicationCore.cpp | 6 +++--- FunctionCore.cpp | 6 ++++-- SelectableBare.cpp | 3 --- SelectableCore.cpp | 16 ---------------- 4 files changed, 7 insertions(+), 24 deletions(-) diff --git a/ApplicationCore.cpp b/ApplicationCore.cpp index 3f6a1b4..e4a5065 100644 --- a/ApplicationCore.cpp +++ b/ApplicationCore.cpp @@ -27,9 +27,9 @@ CApplication::CApplication( EDebugLevel pLogLevel ) // Set signal handlers ConfigureSignalHandlers(); - DefinitionFile = NULL; - ConfigFile = NULL; - AddressFile = NULL; + DefinitionFile = NULL; + ConfigFile = NULL; + AddressFile = NULL; // Create output logger Log = new CLogCore( stdout ); diff --git a/FunctionCore.cpp b/FunctionCore.cpp index a778ead..f902d79 100644 --- a/FunctionCore.cpp +++ b/FunctionCore.cpp @@ -30,9 +30,8 @@ extern CApplication * Application; CFunctionCore::CFunctionCore( const char * pName, const char * pType ) : Type( pType ) { // Set name - if (pName) { + if (pName) Name = strdup( pName ); - } // Logging Log = Application->Log; @@ -101,6 +100,9 @@ bool CFunctionCore::Init( CDataMember * FunctionConfig ) if (!FunctionConfig ) return false; + // Set Type + FunctionConfig->SetChStr( "Type", Type ); + // Configure Logging/Debugging LogConfig = FunctionConfig->GetChild( "Log", true ); pLogLevel = Log->ReadLogLevel( LogConfig ); diff --git a/SelectableBare.cpp b/SelectableBare.cpp index f9aa630..b0603c9 100644 --- a/SelectableBare.cpp +++ b/SelectableBare.cpp @@ -38,9 +38,6 @@ CSelectableBare::CSelectableBare( const char * pName, const char * pType ) : CFu { // Quick access Selector = Application->Selector; - - // Handles - FirstHandle = NULL; } //--------------------------------------------------------------------------- diff --git a/SelectableCore.cpp b/SelectableCore.cpp index a54d54c..99575b4 100644 --- a/SelectableCore.cpp +++ b/SelectableCore.cpp @@ -42,27 +42,11 @@ CFunctionCore * NewSelectableCore( const char * Name ) { CSelectableCore::CSelectableCore( const char * pName, const char * pType ) : CSelectableBare( pName, pType ) { - // Quick access - Selector = Application->Selector; } //--------------------------------------------------------------------------- CSelectableCore::~CSelectableCore() { - THandle * NextHandle = NULL; - - // Destroy File Handles - while (FirstHandle) - { - // Close handle if open - if ((FirstHandle->State == csOpen) || (FirstHandle->State == csWaitingtoOpen)) { - Close( FirstHandle, false ); - } - - NextHandle = FirstHandle->Next; - DestroyHandle( FirstHandle ); - FirstHandle = NextHandle; - } } //---------------------------------------------------------------------------