Function Macro

GLibtry_new0

since: 2.8

Declaration [src]

#define g_try_new0 (
  struct_type,
  n_structs
)

Description [src]

Attempts to allocate n_structs elements of type struct_type, initialized to 0’s, and returns NULL on failure. Contrast with g_new0(), which aborts the program on failure. The returned pointer is cast to a pointer to the given type. The function returns NULL when n_structs is 0 or if an overflow occurs.

Available since: 2.8

This function is not directly available to language bindings.

Parameters

struct_type

Type: -

The type of the elements to allocate.

n_structs

Type: -

The number of elements to allocate.