/*
 * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Created in Samsung Ukraine R&D Center (SRK) under a contract between
 * LLC "Samsung Electronics Ukraine Company" (Kiev, Ukraine)
 * and "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
 *
 * Created on: Dec 15, 2017
 * Author: Kostiantyn Volobuiev <k.volobuyev@samsung.com>
 * Brief: Module that responds for memory operations.
 */

#ifndef TZWMEMORY_H
#define TZWMEMORY_H

#include <stddef.h>
#include <stdint.h>

/**
 * @brief Allocates n bytes on heap, initialize it with 0 and return memory block address
 * @param[in] n - size to be allocated
 * @return a pointer to the newly allocated block
 */
void* tzwMalloc(const size_t n);

/**
 * @brief Resizes a block of memory previously allocated using tzwMalloc() or tzwRealloc()
 * @param[in] ptr - pointer to previously allocated block
 * @param[in] size - new size of block
 * @return a pointer to the newly allocated block, or NULL if the block could not be allocated
 */
void* tzwRealloc(void* ptr, uint32_t size);

/**
 * @brief free previously allocated memory
 * @param[in] buf - pointer to previously allocated block
 */
void tzwFree(void* buf);

#endif // TZWMEMORY_H
