/* * Copyright 2011 Institute of Communication and Computer Systems (ICCS) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /** * \file single_allocator.h * \author Ioannis Koutras (joko@microlab.ntua.gr) * \date September, 2011 * Basic structures needed for the dmmlib allocator. */ #ifndef SINGLE_ALLOCATOR_H #define SINGLE_ALLOCATOR_H #include /* In case stdlib.h is used, there is no need to redeclare * malloc() and free() */ #ifndef __malloc_and_calloc_defined /** * Allocates size bytes by using the system's allocator. * \param size Requested allocation size in bytes. */ void * malloc(size_t size); /** * De-allocates the memory space pointed to by ptr. * \param ptr The pointer to memory to free. */ void free(void *ptr); /** * Try to change the size of an allocation * \param ptr The pointer to the data part of the original memory block. * \param size The new desired size of the block. * * \return The pointer to the data part of the memory block which * has the new, desired size. */ void * realloc(void *ptr, size_t size); #endif /* __malloc_and_calloc_defined */ /** Global variable storing allocator's settings */ allocator_t systemallocator; #endif /* SINGLE_ALLOCATOR_H */