]> granicus.if.org Git - clang/commitdiff
Make RewriteRope less confusing for me. No intended behavior change.
authorNico Weber <nicolasweber@gmx.de>
Wed, 23 Apr 2014 21:42:27 +0000 (21:42 +0000)
committerNico Weber <nicolasweber@gmx.de>
Wed, 23 Apr 2014 21:42:27 +0000 (21:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207032 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Rewrite/Core/RewriteRope.cpp

index fe7aa2d6477dbf9865c0a1a14ee309f3d75c24da..135f42a207ceb148b0cb56f75904ec9aea2fa689 100644 (file)
@@ -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<RopeRefCountString *>(new char[AllocSize]);