Function Macro

GLibslice_dup

Declaration

#define g_slice_dup (
  type,
  mem
)

Description

A convenience macro to duplicate a block of memory using the slice allocator.

It calls g_slice_copy() with sizeof (type) and casts the returned pointer to a pointer of the given type, avoiding a type cast in the source code. Note that the underlying slice allocation mechanism can be changed with the [G_SLICE=always-malloc][G_SLICE] environment variable.

This can never return NULL.

Available since:2.14

Parameters

type none
 

The type to duplicate, typically a structure name.

mem none
 

The memory to copy into the allocated block.