Commit 95a993e5 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

xmalloc, xrealloc: traditional functions to allocate memory

Those functions automatically abort if allocation fails (which is not
quite the same as calling assert()). Avoid these functions in new code.
parent 827b1113
......@@ -814,6 +814,25 @@ static inline const char *vlc_pgettext( const char *ctx, const char *id )
return (tr == ctx) ? id : tr;
}
/*****************************************************************************
* Loosy memory allocation functions. Do not use in new code.
*****************************************************************************/
static inline void *xmalloc (size_t len)
{
void *ptr = malloc (len);
if (unlikely (ptr == NULL))
abort ();
return ptr;
}
static inline void *xrealloc (void *ptr, size_t len)
{
void *nptr = realloc (ptr, len);
if (unlikely (nptr == NULL))
abort ();
return nptr;
}
/*****************************************************************************
* libvlc features
*****************************************************************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment