From 6bd8889456f080d13f74fdf9adca6f2a4d4d841c Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Tue, 21 Oct 2014 07:21:20 +0000 Subject: [PATCH] fixed: in cache.cpp there was headerfile_ezc_cache macro used (copied from cache.h) fixed: in Generator: memory leak from block_stack objects pointing by block_stack_tab[].out_stream were not deleted fixed: in Item: ClearCache() didn't clear all pointers Function::parameters table were not used git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@979 e52654a7-88a9-db11-a3e9-0013d4bc506e --- src/cache.cpp | 6 ------ src/generator.h | 13 +++++++++++++ src/item.cpp | 14 ++++++++++---- src/item.h | 5 +++++ 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/cache.cpp b/src/cache.cpp index 336090e..4125c39 100644 --- a/src/cache.cpp +++ b/src/cache.cpp @@ -35,10 +35,6 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ - -#ifndef headerfile_ezc_cache -#define headerfile_ezc_cache - #include "cache.h" #include "blocks.h" @@ -86,5 +82,3 @@ void Cache(Blocks & blocks, Item & item) } // namespace Ezc - -#endif diff --git a/src/generator.h b/src/generator.h index 827d8a6..8aa2cd2 100755 --- a/src/generator.h +++ b/src/generator.h @@ -239,6 +239,8 @@ private: void ClearFilterTab(); void ClearForStack(); + void ClearBlockStack(); + void ClearStream(StreamType & str); void RemoveStackFunData(Stack & sitem); @@ -416,6 +418,7 @@ Generator::~Generator() { ClearFilterTab(); ClearForStack(); + ClearBlockStack(); } @@ -564,6 +567,16 @@ void Generator::ClearFilterTab() } +template +void Generator::ClearBlockStack() +{ + for(size_t i=0 ; i void Generator::ClearForStack() { diff --git a/src/item.cpp b/src/item.cpp index 710b22e..df8adf5 100755 --- a/src/item.cpp +++ b/src/item.cpp @@ -161,14 +161,20 @@ Item::~Item() } +void Item::ClearCache(Item::Function & function) +{ + function.fun_cache = 0; + function.item_block = 0; + + for(size_t i=0 ; iClearCache(); diff --git a/src/item.h b/src/item.h index 01edda4..36c4f43 100755 --- a/src/item.h +++ b/src/item.h @@ -146,6 +146,11 @@ struct Item void Clear(); void ClearCache(); + +private: + + void ClearCache(Item::Function & function); + };