From 3d4a5a7807c58dece75f6b8e012bc63740ae89db Mon Sep 17 00:00:00 2001 From: Alessandro Bonazzi Date: Tue, 19 May 2020 19:32:56 +0200 Subject: [PATCH] Patch level : 12.0 no-patch Files correlati : Commento : MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Aggiunto metodo per aggiungere un booleano a una token_string Aggiunta safe_delete come funzione da usare al posto dell macro SAFE_DELETE che sarĂ  eliminata --- src/include/strings.h | 6 ++++-- src/include/utility.h | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/include/strings.h b/src/include/strings.h index 7fd64fb55..2c2fe60cf 100755 --- a/src/include/strings.h +++ b/src/include/strings.h @@ -654,8 +654,10 @@ public: void add(int n, int pos = -1); // @cmember Aggiunge un reale void add(const real r, int pos = -1); - // @cmember Aggiunge un reale - void add(const TDate d, int pos = -1); + // @cmember Aggiunge un reale + void add(const TDate d, int pos = -1); + // @cmember Aggiunge un booleano + void add(bool on, int pos = -1) { add(on ? "X" : ""); } // @cmember Inserisce una stringa void insert_at(const char* s, int n); // @cmember Toglie la stringa di posizione pos diff --git a/src/include/utility.h b/src/include/utility.h index 3320559ec..158a7e7c1 100755 --- a/src/include/utility.h +++ b/src/include/utility.h @@ -16,7 +16,7 @@ #include #define STRINGIFY(x) #x -#define SAFE_DELETE(p) { if( (p) != nullptr ) delete (p); (p) = nullptr; } +#define SAFE_DELETE(p) safe_delete(p) #define TOSTRING(x) STRINGIFY(x) #define DEBUG_ENABLED is_debug_station() @@ -24,6 +24,10 @@ bool sirio_codesigning(const TFilename& filename, bool verify = false); #define SIRIOSIGN(filename) sirio_codesigning((const TFilename&)((filename)), false) #define SIRIOSIGN_VERIFY(filename) sirio_codesigning((const TFilename&)((filename)), true) +template void safe_delete(T*& a) { + delete a; + a = nullptr; +} class TPerformance_profiler : public TObject {