Function

GLibtry_realloc

Declaration

gpointer
g_try_realloc (
  gpointer mem,
  gsize n_bytes
)

Description

Attempts to realloc mem to a new size, n_bytes, and returns NULL on failure. Contrast with g_realloc(), which aborts the program on failure.

If mem is NULL, behaves the same as g_try_malloc().

Parameters

mem gpointer
 

Previously-allocated memory, or NULL.

n_bytes gsize
 

Number of bytes to allocate.

Return value

Returns: gpointer
 

The allocated memory, or NULL.