1// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3
4#include "include/private/SkMalloc.h"
5
6#include "src/core/SkSafeMath.h"
7
8void* sk_calloc_throw(size_t count, size_t elemSize) {
9 return sk_calloc_throw(SkSafeMath::Mul(count, elemSize));
10}
11
12void* sk_malloc_throw(size_t count, size_t elemSize) {
13 return sk_malloc_throw(SkSafeMath::Mul(count, elemSize));
14}
15
16void* sk_realloc_throw(void* buffer, size_t count, size_t elemSize) {
17 return sk_realloc_throw(buffer, SkSafeMath::Mul(count, elemSize));
18}
19
20void* sk_malloc_canfail(size_t count, size_t elemSize) {
21 return sk_malloc_canfail(SkSafeMath::Mul(count, elemSize));
22}
23