119656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov/* 219656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov * Copyright (C) 2015 The Android Open Source Project 319656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov * 419656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov * Licensed under the Apache License, Version 2.0 (the "License"); 519656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov * you may not use this file except in compliance with the License. 619656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov * You may obtain a copy of the License at 719656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov * 819656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov * http://www.apache.org/licenses/LICENSE-2.0 919656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov * 1019656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov * Unless required by applicable law or agreed to in writing, software 1119656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov * distributed under the License is distributed on an "AS IS" BASIS, 1219656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1319656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov * See the License for the specific language governing permissions and 1419656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov * limitations under the License. 1519656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov */ 1619656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov 1719656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov#include "linker_allocator.h" 1819656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov 1919656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov#include <stdlib.h> 2019656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov 2119656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanovstatic LinkerMemoryAllocator g_linker_allocator; 2219656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov 2319656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanovvoid* malloc(size_t byte_count) { 2419656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov return g_linker_allocator.alloc(byte_count); 2519656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov} 2619656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov 2719656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanovvoid* calloc(size_t item_count, size_t item_size) { 2819656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov return g_linker_allocator.alloc(item_count*item_size); 2919656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov} 3019656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov 3119656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanovvoid* realloc(void* p, size_t byte_count) { 3219656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov return g_linker_allocator.realloc(p, byte_count); 3319656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov} 3419656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov 3519656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanovvoid free(void* ptr) { 3619656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov g_linker_allocator.free(ptr); 3719656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov} 3819656ce5376c95ce0deebc4d0c6af1bb8d740934Dmitriy Ivanov 39