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: sberg...@redhat.com
                CC: libreoff...@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 the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to