Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 1 | /** |
| 2 | * \file memory.h |
| 3 | * |
Manuel Pégourié-Gonnard | 7143284 | 2015-03-20 16:19:35 +0000 | [diff] [blame] | 4 | * \brief Memory allocation layer |
| 5 | * |
| 6 | * \deprecated Use the platform layer instead |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 7 | * |
Manuel Pégourié-Gonnard | a658a40 | 2015-01-23 09:45:19 +0000 | [diff] [blame] | 8 | * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 9 | * |
Manuel Pégourié-Gonnard | fe44643 | 2015-03-06 13:17:10 +0000 | [diff] [blame] | 10 | * This file is part of mbed TLS (https://tls.mbed.org) |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 11 | * |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation; either version 2 of the License, or |
| 15 | * (at your option) any later version. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License along |
| 23 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 24 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 25 | */ |
| 26 | #ifndef POLARSSL_MEMORY_H |
| 27 | #define POLARSSL_MEMORY_H |
| 28 | |
Manuel Pégourié-Gonnard | cef4ad2 | 2014-04-29 12:39:06 +0200 | [diff] [blame] | 29 | #if !defined(POLARSSL_CONFIG_FILE) |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 30 | #include "config.h" |
Manuel Pégourié-Gonnard | cef4ad2 | 2014-04-29 12:39:06 +0200 | [diff] [blame] | 31 | #else |
| 32 | #include POLARSSL_CONFIG_FILE |
| 33 | #endif |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 34 | |
| 35 | #include <stdlib.h> |
| 36 | |
Paul Bakker | defc0ca | 2014-02-04 17:30:24 +0100 | [diff] [blame] | 37 | #include "platform.h" |
| 38 | #include "memory_buffer_alloc.h" |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 39 | |
Manuel Pégourié-Gonnard | c70581c | 2015-03-23 13:58:27 +0100 | [diff] [blame] | 40 | #if ! defined(POLARSSL_DEPRECATED_REMOVED) |
| 41 | #if defined(POLARSSL_DEPRECATED_WARNING) |
| 42 | #define DEPRECATED __attribute__((deprecated)) |
| 43 | #else |
| 44 | #define DEPRECATED |
| 45 | #endif |
Manuel Pégourié-Gonnard | 7143284 | 2015-03-20 16:19:35 +0000 | [diff] [blame] | 46 | /** |
| 47 | * \brief Set malloc() / free() callback |
| 48 | * |
| 49 | * \deprecated Use platform_set_malloc_free instead |
| 50 | */ |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 51 | int memory_set_own( void * (*malloc_func)( size_t ), |
Manuel Pégourié-Gonnard | c70581c | 2015-03-23 13:58:27 +0100 | [diff] [blame] | 52 | void (*free_func)( void * ) ) DEPRECATED; |
| 53 | int memory_set_own( void * (*malloc_func)( size_t ), |
Paul Bakker | defc0ca | 2014-02-04 17:30:24 +0100 | [diff] [blame] | 54 | void (*free_func)( void * ) ) |
| 55 | { |
| 56 | return platform_set_malloc_free( malloc_func, free_func ); |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 57 | } |
Manuel Pégourié-Gonnard | c70581c | 2015-03-23 13:58:27 +0100 | [diff] [blame] | 58 | #undef DEPRECATED |
| 59 | #endif /* POLARSSL_DEPRECATED_REMOVED */ |
Paul Bakker | defc0ca | 2014-02-04 17:30:24 +0100 | [diff] [blame] | 60 | |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 61 | |
| 62 | #endif /* memory.h */ |