summaryrefslogtreecommitdiff
path: root/chromium/third_party/icu/patches/changeset_30255.patch
blob: d7cc04277d35de0dfeff9b081a43767b20d772ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Index: /icu/trunk/source/common/rbbi.cpp
===================================================================
--- /icu/trunk/source/common/rbbi.cpp	(revision 30203)
+++ /icu/trunk/source/common/rbbi.cpp	(revision 30255)
@@ -1566,17 +1566,6 @@
     //
     //  Clone the source BI into the caller-supplied buffer.
-    //    TODO:  using an overloaded operator new to directly initialize the
-    //           copy in the user's buffer would be better, but it doesn't seem
-    //           to get along with namespaces.  Investigate why.
     //
-    //           The memcpy is only safe with an empty (default constructed)
-    //           break iterator.  Use on others can screw up reference counts
-    //           to data.  memcpy-ing objects is not really a good idea...
-    //
-    RuleBasedBreakIterator localIter;        // Empty break iterator, source for memcpy
-    RuleBasedBreakIterator *clone = (RuleBasedBreakIterator *)buf;
-    uprv_memcpy(clone, &localIter, sizeof(RuleBasedBreakIterator)); // init C++ gorp, BreakIterator base class part
-    clone->init();                // Init RuleBasedBreakIterator part, (user default constructor)
-    *clone = *this;               // clone = the real BI we want.
+    RuleBasedBreakIterator *clone = new(buf) RuleBasedBreakIterator(*this);
     clone->fBufferClone = TRUE;   // Flag to prevent deleting storage on close (From C code)