Function Macro

GLibVARIANT_BUILDER_INIT

Declaration [src]

#define G_VARIANT_BUILDER_INIT (
  variant_type
)

Description [src]

A stack-allocated GVariantBuilder must be initialized if it is used together with g_auto() to avoid warnings or crashes if function returns before g_variant_builder_init() is called on the builder.

This macro can be used as initializer instead of an explicit zeroing a variable when declaring it and a following g_variant_builder_init(), but it cannot be assigned to a variable.

The passed variant_type should be a static GVariantType to avoid lifetime issues, as copying the variant_type does not happen in the G_VARIANT_BUILDER_INIT() call, but rather in functions that make sure that GVariantBuilder is valid.

  g_auto(GVariantBuilder) builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_BYTESTRING);
Available since:2.50

Parameters

variant_type -
 

A const GVariantType*