From 669df123648aaa6aeccc70206b5417bc48b4e9ae Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:26:50 +0200 Subject: 5.19 --- zen/zstring.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'zen/zstring.cpp') diff --git a/zen/zstring.cpp b/zen/zstring.cpp index a469ade2..1cc037e8 100644 --- a/zen/zstring.cpp +++ b/zen/zstring.cpp @@ -33,19 +33,15 @@ public: void insert(const void* ptr, size_t size) { boost::lock_guard dummy(lockActStrings); - if (activeStrings.find(ptr) != activeStrings.end()) + if (!activeStrings.insert(std::make_pair(ptr, size)).second) reportProblem("Fatal Error: New memory points into occupied space: " + rawMemToString(ptr, size)); - - activeStrings[ptr] = size; } void remove(const void* ptr) { boost::lock_guard dummy(lockActStrings); - if (activeStrings.find(ptr) == activeStrings.end()) + if (activeStrings.erase(ptr) != 1) reportProblem("Fatal Error: No memory available for deallocation at this location!"); - - activeStrings.erase(ptr); } static LeakChecker& instance() { static LeakChecker inst; return inst; } -- cgit