Remove dangerous constructor from SkArenaAlloc
authorHerb Derby <herb@google.com>
Fri, 14 Apr 2017 18:51:27 +0000 (14:51 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Fri, 14 Apr 2017 19:42:55 +0000 (19:42 +0000)
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 <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>

src/core/SkArenaAlloc.h
tests/ArenaAllocTest.cpp

index 494696ce768d36b4f255143beebbba09f243de8a..488adfc681034677f16a44d2c9ec799f18927bcf 100644 (file)
@@ -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 <size_t kSize>
     SkArenaAlloc(char (&block)[kSize], size_t extraSize = kSize)
index c27c202bdb5823799ee2b9cc5cb51b3d755dc59c..cb2ae0e5e3f6e8082070e40540f4e78fcd569020 100644 (file)
@@ -68,7 +68,7 @@ DEF_TEST(ArenaAlloc, r) {
         created = 0;
         destroyed = 0;
 
-        SkArenaAlloc arena{nullptr, 0};
+        SkArenaAlloc arena{0};
         REPORTER_ASSERT(r, *arena.make<int>(3) == 3);
         Foo* foo = arena.make<Foo>(3, 4.0f);
         REPORTER_ASSERT(r, foo->x == 3);
@@ -121,7 +121,7 @@ DEF_TEST(ArenaAlloc, r) {
         created = 0;
         destroyed = 0;
         std::unique_ptr<char[]> block{new char[1024]};
-        SkArenaAlloc arena{block.get(), 1024};
+        SkArenaAlloc arena{block.get(), 1024, 0};
 
         REPORTER_ASSERT(r, *arena.make<int>(3) == 3);
         Foo* foo = arena.make<Foo>(3, 4.0f);