From: Nico Weber Date: Wed, 23 Apr 2014 21:42:27 +0000 (+0000) Subject: Make RewriteRope less confusing for me. No intended behavior change. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d60acf3e938076cc570c03730efaa47031c80549;p=clang Make RewriteRope less confusing for me. No intended behavior change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207032 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Rewrite/Core/RewriteRope.cpp b/lib/Rewrite/Core/RewriteRope.cpp index fe7aa2d647..135f42a207 100644 --- a/lib/Rewrite/Core/RewriteRope.cpp +++ b/lib/Rewrite/Core/RewriteRope.cpp @@ -788,9 +788,8 @@ RopePiece RewriteRope::MakeRopeString(const char *Start, const char *End) { // Otherwise, this was a small request but we just don't have space for it // Make a new chunk and share it with later allocations. - // If we had an old allocation, drop our reference to it. - if (AllocBuffer && --AllocBuffer->RefCount == 0) - delete [] (char*)AllocBuffer; + if (AllocBuffer) + AllocBuffer->dropRef(); unsigned AllocSize = offsetof(RopeRefCountString, Data) + AllocChunkSize; AllocBuffer = reinterpret_cast(new char[AllocSize]);