Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: fpdfsdk/fpdfdoc.cpp

Issue 2571913002: Avoid the ptr.reset(new XXX()) anti-pattern (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fxcodec/jbig2/JBig2_TrdProc.cpp ('k') | fpdfsdk/fpdfdoc_unittest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdfdoc.cpp
diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp
index ce4fc34982f143b47708681e376e78b753b37b10..82b898aa85b86a1b52abff90536f039411eca55e 100644
--- a/fpdfsdk/fpdfdoc.cpp
+++ b/fpdfsdk/fpdfdoc.cpp
@@ -17,6 +17,7 @@
#include "core/fpdfdoc/cpdf_dest.h"
#include "core/fpdfdoc/cpdf_pagelabel.h"
#include "fpdfsdk/fsdk_define.h"
+#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
namespace {
@@ -55,7 +56,7 @@ CPDF_LinkList* GetLinkList(CPDF_Page* page) {
CPDF_Document* pDoc = page->m_pDocument;
std::unique_ptr<CPDF_LinkList>* pHolder = pDoc->LinksContext();
if (!pHolder->get())
- pHolder->reset(new CPDF_LinkList);
+ *pHolder = pdfium::MakeUnique<CPDF_LinkList>();
return pHolder->get();
}
« no previous file with comments | « core/fxcodec/jbig2/JBig2_TrdProc.cpp ('k') | fpdfsdk/fpdfdoc_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698