From dcbe2c8a567be14c7498639f0bd40d0b8c2058ea Mon Sep 17 00:00:00 2001 From: Herb Derby Date: Fri, 14 Apr 2017 14:51:27 -0400 Subject: [PATCH] Remove dangerous constructor from SkArenaAlloc Make the constructors for SkArenaAlloc unambiguous. TBR=mtklein@google.com Change-Id: Iaa6419574e78e17bf746f5f9bcdf99c9d6c9d727 Reviewed-on: https://skia-review.googlesource.com/13540 Reviewed-by: Herb Derby Commit-Queue: Herb Derby --- src/core/SkArenaAlloc.h | 2 +- tests/ArenaAllocTest.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/SkArenaAlloc.h b/src/core/SkArenaAlloc.h index 494696ce76..488adfc681 100644 --- a/src/core/SkArenaAlloc.h +++ b/src/core/SkArenaAlloc.h @@ -59,7 +59,7 @@ // there are 71 allocations. class SkArenaAlloc { public: - SkArenaAlloc(char* block, size_t size, size_t extraSize = 0); + SkArenaAlloc(char* block, size_t size, size_t extraSize); template SkArenaAlloc(char (&block)[kSize], size_t extraSize = kSize) diff --git a/tests/ArenaAllocTest.cpp b/tests/ArenaAllocTest.cpp index c27c202bdb..cb2ae0e5e3 100644 --- a/tests/ArenaAllocTest.cpp +++ b/tests/ArenaAllocTest.cpp @@ -68,7 +68,7 @@ DEF_TEST(ArenaAlloc, r) { created = 0; destroyed = 0; - SkArenaAlloc arena{nullptr, 0}; + SkArenaAlloc arena{0}; REPORTER_ASSERT(r, *arena.make(3) == 3); Foo* foo = arena.make(3, 4.0f); REPORTER_ASSERT(r, foo->x == 3); @@ -121,7 +121,7 @@ DEF_TEST(ArenaAlloc, r) { created = 0; destroyed = 0; std::unique_ptr block{new char[1024]}; - SkArenaAlloc arena{block.get(), 1024}; + SkArenaAlloc arena{block.get(), 1024, 0}; REPORTER_ASSERT(r, *arena.make(3) == 3); Foo* foo = arena.make(3, 4.0f); -- 2.34.1