MGE General C Library - Full Internal Documentation v1.8.0
Library of general C functions.
memory.c File Reference

Memory functions. More...

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <libmgec/mge-errno.h>
#include <libmgec/mge-memory.h>
Include dependency graph for memory.c:

Functions

char * mg_realloc (char *mem_ptr, const size_t mem_sz)
 Wrap realloc to include error handling. More...
 

Detailed Description

Memory functions.

All memory related support functions.

Author
Copyright (C) 2017-2019, 2021, 2022 Mark Grant

Released under the GPLv3 only.
SPDX-License-Identifier: GPL-3.0-only

Version
v1.0.8 ==== 16/09/2022

Function Documentation

◆ mg_realloc()

char * mg_realloc ( char *  mem_ptr,
const size_t  mem_sz 
)

Wrap realloc to include error handling.

Also used for a malloc by passing mem_ptr as NULL. On error mge_errno will be set and the old mem_ptr will be unchanged.

Parameters
mem_ptrThe memory area to be re-sized.
mem_szThe new size required.
Returns
the new memory area or NULL on error.