/*
 * Copyright (C) 2019 SAMSUNG S.LSI
 *
 * 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.
 */

#ifndef __ESE_UTIL__H
#define __ESE_UTIL__H

/**
 * @file ese_util.h
 * @brief Memory related utilities.
 */

/**
 * @ingroup common
 * @defgroup ese_util eSE_Util
 * @brief Memory related utilities.
 *
 * This header file provides utilities related to memory.
 * @{
 */

#include <ese_log.h>
#include "tz_debug.h"
#include "tz_utils.h"

#ifdef MEMORY_LEAK_TEST
void *ese_malloc(size_t size);
void ese_free(void *ptr);
void ese_print_list(void);

/**
 * @brief Memory allocation macro.
 */
#define ESE_MALLOC		ese_malloc

/**
 * @brief Memory free macro.
 */
#define ESE_FREE		ese_free
/**
 * @brief Print allocated memory.
 */
#define ESE_PRINT_LIST() ese_print_list()
#else
/**
 * @brief Memory allocation macro.
 */
#define ESE_MALLOC		tz_malloc

/**
 * @brief Memory free macro.
 */
#define ESE_FREE		tz_free
/**
 * @brief Print allocated memory.
 */
#define ESE_PRINT_LIST()
#endif
/**
 * @}
 */
#endif
