Function Macro

GLibnew0

Declaration [src]

#define g_new0 (
  struct_type,
  n_structs
)

Description [src]

Allocates n_structs elements of type struct_type, initialized to 0’s. The returned pointer is cast to a pointer to the given type. If n_structs is 0 it returns NULL. Care is taken to avoid overflow when calculating the size of the allocated block.

Since the returned pointer is already casted to the right type, it is normally unnecessary to cast it explicitly, and doing so might hide memory allocation errors.

Parameters

struct_type -
 

The type of the elements to allocate.

n_structs -
 

The number of elements to allocate.