Function

GLibrealloc_n

since: 2.24

Declaration

gpointer
g_realloc_n (
  gpointer mem,
  gsize n_blocks,
  gsize n_block_bytes
)

Description

This function is similar to g_realloc(), allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.

If the allocation fails (because the system is out of memory), the program is terminated.

Available since: 2.24

Parameters

mem

Type: gpointer

The memory to reallocate.

The argument can be NULL.
The data is owned by the caller of the function.
n_blocks

Type: gsize

The number of blocks to allocate.

n_block_bytes

Type: gsize

The size of each block in bytes.

Return value

Type: gpointer

The new address of the allocated memory.

The data is owned by the called function.
The return value can be NULL.