Memory management wrappers. More...
#include <stddef.h>
Include dependency graph for memory.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Macros | |
| #define | MAX(a, b) |
| #define | MIN(a, b) |
| #define | CLAMP(val, lo, hi) |
| #define | ROUND_UP(NUM, STEP) |
| #define | countof(x) |
| #define | MUTT_MEM_CALLOC(n, type) |
| #define | MUTT_MEM_MALLOC(n, type) |
| #define | MUTT_MEM_REALLOC(pptr, n, type) |
| #define | FREE(x) |
Functions | |
| void * | mutt_mem_calloc (size_t nmemb, size_t size) |
| Allocate zeroed memory on the heap. | |
| void | mutt_mem_free (void *ptr) |
| Release memory allocated on the heap. | |
| void * | mutt_mem_malloc (size_t size) |
| Allocate memory on the heap. | |
| void * | mutt_mem_mallocarray (size_t nmemb, size_t size) |
| Allocate memory on the heap (array version) | |
| void | mutt_mem_realloc (void *pptr, size_t size) |
| Resize a block of memory on the heap. | |
| void | mutt_mem_reallocarray (void *pptr, size_t nmemb, size_t size) |
| Resize a block of memory on the heap (array version) | |
Memory management wrappers.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file memory.h.
| #define CLAMP | ( | val, | |
| lo, | |||
| hi ) |
| #define ROUND_UP | ( | NUM, | |
| STEP ) |
| #define MUTT_MEM_CALLOC | ( | n, | |
| type ) |
| #define MUTT_MEM_MALLOC | ( | n, | |
| type ) |
| #define MUTT_MEM_REALLOC | ( | pptr, | |
| n, | |||
| type ) |
Definition at line 50 of file memory.h.
| #define FREE | ( | x | ) |
| void * mutt_mem_calloc | ( | size_t | nmemb, |
| size_t | size ) |
Allocate zeroed memory on the heap.
| nmemb | Number of blocks |
| size | Size of blocks |
| ptr | Memory on the heap |
The caller should call mutt_mem_free() to release the memory
Definition at line 76 of file memory.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void mutt_mem_free | ( | void * | ptr | ) |
| void * mutt_mem_malloc | ( | size_t | size | ) |
Allocate memory on the heap.
| size | Size of block to allocate |
| ptr | Memory on the heap |
The caller should call mutt_mem_free() to release the memory
Definition at line 113 of file memory.c.
Here is the call graph for this function:| void * mutt_mem_mallocarray | ( | size_t | nmemb, |
| size_t | size ) |
Allocate memory on the heap (array version)
| nmemb | Number of blocks |
| size | Size of blocks |
| ptr | Memory on the heap |
The caller should call mutt_mem_free() to release the memory
Definition at line 129 of file memory.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void mutt_mem_realloc | ( | void * | pptr, |
| size_t | size ) |
Resize a block of memory on the heap.
| pptr | Address of pointer to memory block to resize |
| size | New size |
If the new size is zero, the block will be freed.
Definition at line 146 of file memory.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void mutt_mem_reallocarray | ( | void * | pptr, |
| size_t | nmemb, | ||
| size_t | size ) |
Resize a block of memory on the heap (array version)
| pptr | Address of pointer to memory block to resize |
| nmemb | Number of blocks |
| size | Size of blocks |
If the new size is zero, the block will be freed.
Definition at line 162 of file memory.c.
Here is the call graph for this function:
Here is the caller graph for this function: