r207032 - Make RewriteRope less confusing for me. No intended behavior change.

Nico Weber nicolasweber at gmx.de
Wed Apr 23 14:42:27 PDT 2014


Author: nico
Date: Wed Apr 23 16:42:27 2014
New Revision: 207032

URL: http://llvm.org/viewvc/llvm-project?rev=207032&view=rev
Log:
Make RewriteRope less confusing for me. No intended behavior change.

Modified:
    cfe/trunk/lib/Rewrite/Core/RewriteRope.cpp

Modified: cfe/trunk/lib/Rewrite/Core/RewriteRope.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/Core/RewriteRope.cpp?rev=207032&r1=207031&r2=207032&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/Core/RewriteRope.cpp (original)
+++ cfe/trunk/lib/Rewrite/Core/RewriteRope.cpp Wed Apr 23 16:42:27 2014
@@ -788,9 +788,8 @@ RopePiece RewriteRope::MakeRopeString(co
   // 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<RopeRefCountString *>(new char[AllocSize]);





More information about the cfe-commits mailing list