aboutsummaryrefslogtreecommitdiff
path: root/lib/Rewrite/RewriteRope.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2008-09-16 07:58:21 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2008-09-16 07:58:21 +0000
commit3f61c18dd765c27bf900b22dc3a5f2a68e2364a1 (patch)
tree9a6a83a0ede22d55527310fe5fc677835b521a2a /lib/Rewrite/RewriteRope.cpp
parenta95d3750441ac8ad03e36af8e6e74039c9a3109d (diff)
Fixed an offset calculation error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56242 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Rewrite/RewriteRope.cpp')
-rw-r--r--lib/Rewrite/RewriteRope.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Rewrite/RewriteRope.cpp b/lib/Rewrite/RewriteRope.cpp
index 0a4dc85968..61cb02b9a5 100644
--- a/lib/Rewrite/RewriteRope.cpp
+++ b/lib/Rewrite/RewriteRope.cpp
@@ -792,7 +792,7 @@ RopePiece RewriteRope::MakeRopeString(const char *Start, const char *End) {
if (AllocBuffer && --AllocBuffer->RefCount == 0)
delete [] (char*)AllocBuffer;
- unsigned AllocSize = sizeof(RopeRefCountString)-1+AllocChunkSize;
+ unsigned AllocSize = offsetof(RopeRefCountString, Data) + AllocChunkSize;
AllocBuffer = reinterpret_cast<RopeRefCountString *>(new char[AllocSize]);
AllocBuffer->RefCount = 0;
memcpy(AllocBuffer->Data, Start, Len);