gwion-util
utilities for the Gwion project
Loading...
Searching...
No Matches
Macros | Functions
xalloc.h File Reference

Go to the source code of this file.

Macros

#define xfree(a)   free(a)
 

Functions

static void * xcheck (void *a)
 
static ANEW void * xmalloc (const m_uint sz)
 
static ANEW void * xcalloc (const m_uint n, const m_uint sz)
 
static ANEW void * xrealloc (void *p, const m_uint sz)
 

Macro Definition Documentation

◆ xfree

#define xfree ( a)    free(a)

Definition at line 28 of file xalloc.h.

Function Documentation

◆ xcalloc()

static ANEW void * xcalloc ( const m_uint n,
const m_uint sz )
inlinestatic

Definition at line 18 of file xalloc.h.

18 {
19 void *a = calloc(n, sz);
20 return xcheck(a);
21}
static void * xcheck(void *a)
Definition xalloc.h:4

◆ xcheck()

static void * xcheck ( void * a)
static

Definition at line 4 of file xalloc.h.

4 {
5 if (a) return a;
6 gw_err(_("Out of Memory\n"));
7 THREAD_RETURN(NULL);
8}
#define _(String)
Definition defs.h:13
#define gw_err(...)
similar to fprintf(stderr, fmt, ...)
Definition err_msg.h:11
#define THREAD_RETURN(arg)

◆ xmalloc()

static ANEW void * xmalloc ( const m_uint sz)
inlinestatic

Definition at line 13 of file xalloc.h.

13 {
14 void *a = malloc(sz);
15 return xcheck(a);
16}

◆ xrealloc()

static ANEW void * xrealloc ( void * p,
const m_uint sz )
inlinestatic

Definition at line 23 of file xalloc.h.

23 {
24 void *a = realloc(p, sz);
25 return xcheck(a);
26}