Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


https://bugs.documentfoundation.org/show_bug.cgi?id=94205

            Bug ID: 94205
           Summary: Use o3tl::make_unique instead of new + std::move
           Product: LibreOffice
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: medium
         Component: LibreOffice
          Assignee: libreoffice-bugs@lists.freedesktop.org
          Reporter: sbergman@redhat.com
                CC: libreoffice@lists.freedesktop.org

Some places across the code base that currently instantiate a local
std::unique_ptr and then std::move it into a function call can make use of
std::make_unique instead (which is only C++14, so we have o3tl::make_unique for
now, #include <o3tl/make_unique.hxx>).

For example:

diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index a9b8c69..bab81f6 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -58,7 +58,6 @@
 #include <cppuhelper/implbase.hxx>
 
 #include <cassert>
-#include <memory>
 
 namespace basctl
 {
@@ -254,9 +253,9 @@ void CheckBox::InitEntry(SvTreeListEntry* pEntry, const OUString& rTxt,
         for ( sal_uInt16 nCol = 1; nCol < nCount; ++nCol )
         {
             SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nCol ));
-            std::unique_ptr<LibLBoxString> pStr(
-                   new LibLBoxString( pEntry, 0, rCol.GetText()));
-            pEntry->ReplaceItem(std::move(pStr), nCol);
+            pEntry->ReplaceItem(
+                o3tl::make_unique<LibLBoxString>(pEntry, 0, rCol.GetText()),
+                nCol);
         }
     }
 }

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.