blob: 3af39511b44655c2e29e01e81f883adfcd53241b [file] [log] [blame]
Paul Bakker6e339b52013-07-03 13:37:05 +02001/**
2 * \file memory.h
3 *
Paul Bakkerdefc0ca2014-02-04 17:30:24 +01004 * \brief Memory allocation layer (Deprecated to platform layer)
Paul Bakker6e339b52013-07-03 13:37:05 +02005 *
Paul Bakkerdefc0ca2014-02-04 17:30:24 +01006 * Copyright (C) 2006-2014, Brainspark B.V.
Paul Bakker6e339b52013-07-03 13:37:05 +02007 *
8 * This file is part of PolarSSL (http://www.polarssl.org)
9 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
10 *
11 * All rights reserved.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 */
27#ifndef POLARSSL_MEMORY_H
28#define POLARSSL_MEMORY_H
29
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020030#if !defined(POLARSSL_CONFIG_FILE)
Paul Bakker6e339b52013-07-03 13:37:05 +020031#include "config.h"
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020032#else
33#include POLARSSL_CONFIG_FILE
34#endif
Paul Bakker6e339b52013-07-03 13:37:05 +020035
36#include <stdlib.h>
37
Paul Bakkerdefc0ca2014-02-04 17:30:24 +010038#if defined(POLARSSL_MEMORY_C) && !defined(POLARSSL_PLATFORM_MEMORY)
39#define POLARSSL_PLATFORM_MEMORY
Paul Bakker6e339b52013-07-03 13:37:05 +020040#endif
41
Paul Bakkerdefc0ca2014-02-04 17:30:24 +010042#include "platform.h"
43#include "memory_buffer_alloc.h"
Paul Bakker6e339b52013-07-03 13:37:05 +020044
Paul Bakker6e339b52013-07-03 13:37:05 +020045int memory_set_own( void * (*malloc_func)( size_t ),
Paul Bakkerdefc0ca2014-02-04 17:30:24 +010046 void (*free_func)( void * ) )
47{
48 return platform_set_malloc_free( malloc_func, free_func );
Paul Bakker6e339b52013-07-03 13:37:05 +020049}
Paul Bakkerdefc0ca2014-02-04 17:30:24 +010050
Paul Bakker6e339b52013-07-03 13:37:05 +020051
52#endif /* memory.h */