Function Macro

GLibslice_new0

since: 2.10

Declaration

#define g_slice_new0 (
  type
)

Description

A convenience macro to allocate a block of memory from the slice allocator and set the memory to 0.

It calls g_slice_alloc0() with sizeof (type) and casts the returned pointer to a pointer of the given type, avoiding a type cast in the source code.

This can never return NULL as the minimum allocation size from sizeof (type) is 1 byte.

Since GLib 2.76 this always uses the system malloc() implementation internally.

Available since: 2.10

This function is not directly available to language bindings.

Parameters

type

Type: -

The type to allocate, typically a structure name.