Function Macro

GLibDEFINE_AUTO_CLEANUP_FREE_FUNC

since: 2.44

Declaration [src]

#define G_DEFINE_AUTO_CLEANUP_FREE_FUNC (
  TypeName,
  func,
  none
)

Description [src]

Defines the appropriate cleanup function for a type.

With this definition, it will be possible to use g_auto() with TypeName.

This function will be rarely used. It is used with pointer-based typedefs and non-pointer types where the value of the variable represents a resource that must be freed. Two examples are GStrv and file descriptors.

none specifies the “none” value for the type in question. It is probably something like NULL or -1. If the variable is found to contain this value then the free function will not be called.

G_DEFINE_AUTO_CLEANUP_FREE_FUNC(GStrv, g_strfreev, NULL)

This macro should be used unconditionally; it is a no-op on compilers where cleanup is not supported.

Available since: 2.44

This function is not directly available to language bindings.

Parameters

TypeName

Type: -

A type name to define a g_auto() cleanup function for.

func

Type: -

The free function.

none

Type: -

The “none” value for the type.