Update glib-mkenums
templates (#2939)
* Avoid writing the full path in enumtypes.h Helps reproducible builds, as build paths can vary between builds. * Use g_intern_static_string() for enum/flags type names We are emitting a static string, so use that shortcut function to intern it, which will save one allocation. * Use g_once_init_enter/leave to register enum/flags type names This is the more modern way, and ensures thread-safety.
This commit is contained in:
parent
fa6c034b32
commit
a498680094
@ -7,7 +7,7 @@ G_BEGIN_DECLS
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
/* enumerations from "@filename@" */
|
||||
/* enumerations from "@basename@" */
|
||||
/*** END file-production ***/
|
||||
|
||||
/*** BEGIN value-header ***/
|
||||
|
@ -8,16 +8,16 @@
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
/* enumerations from "@filename@" */
|
||||
/* enumerations from "@basename@" */
|
||||
/*** END file-production ***/
|
||||
|
||||
/*** BEGIN value-header ***/
|
||||
GType
|
||||
@enum_name@_get_type( void )
|
||||
{
|
||||
static GType etype = 0;
|
||||
static gsize gtype_id = 0;
|
||||
|
||||
if( etype == 0 ) {
|
||||
if( g_once_init_enter( >ype_id ) ) {
|
||||
static const G@Type@Value values[] = {
|
||||
/*** END value-header ***/
|
||||
|
||||
@ -28,10 +28,13 @@ GType
|
||||
/*** BEGIN value-tail ***/
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
etype = g_@type@_register_static( "@EnumName@", values );
|
||||
|
||||
GType new_type =
|
||||
g_@type@_register_static( g_intern_static_string( "@EnumName@" ), values );
|
||||
g_once_init_leave( >ype_id, new_type );
|
||||
}
|
||||
|
||||
return( etype );
|
||||
return( (GType) gtype_id );
|
||||
}
|
||||
/*** END value-tail ***/
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#define VIPS_ENUM_TYPES_H
|
||||
|
||||
G_BEGIN_DECLS
|
||||
/* enumerations from "../../../libvips/include/vips/arithmetic.h" */
|
||||
/* enumerations from "arithmetic.h" */
|
||||
VIPS_API
|
||||
GType vips_operation_math_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_OPERATION_MATH (vips_operation_math_get_type())
|
||||
@ -30,18 +30,18 @@ GType vips_operation_complex2_get_type (void) G_GNUC_CONST;
|
||||
VIPS_API
|
||||
GType vips_operation_complexget_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_OPERATION_COMPLEXGET (vips_operation_complexget_get_type())
|
||||
/* enumerations from "../../../libvips/include/vips/basic.h" */
|
||||
/* enumerations from "basic.h" */
|
||||
VIPS_API
|
||||
GType vips_precision_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_PRECISION (vips_precision_get_type())
|
||||
/* enumerations from "../../../libvips/include/vips/colour.h" */
|
||||
/* enumerations from "colour.h" */
|
||||
VIPS_API
|
||||
GType vips_intent_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_INTENT (vips_intent_get_type())
|
||||
VIPS_API
|
||||
GType vips_pcs_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_PCS (vips_pcs_get_type())
|
||||
/* enumerations from "../../../libvips/include/vips/conversion.h" */
|
||||
/* enumerations from "conversion.h" */
|
||||
VIPS_API
|
||||
GType vips_extend_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_EXTEND (vips_extend_get_type())
|
||||
@ -66,15 +66,15 @@ GType vips_interesting_get_type (void) G_GNUC_CONST;
|
||||
VIPS_API
|
||||
GType vips_blend_mode_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_BLEND_MODE (vips_blend_mode_get_type())
|
||||
/* enumerations from "../../../libvips/include/vips/convolution.h" */
|
||||
/* enumerations from "convolution.h" */
|
||||
VIPS_API
|
||||
GType vips_combine_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_COMBINE (vips_combine_get_type())
|
||||
/* enumerations from "../../../libvips/include/vips/draw.h" */
|
||||
/* enumerations from "draw.h" */
|
||||
VIPS_API
|
||||
GType vips_combine_mode_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_COMBINE_MODE (vips_combine_mode_get_type())
|
||||
/* enumerations from "../../../libvips/include/vips/foreign.h" */
|
||||
/* enumerations from "foreign.h" */
|
||||
VIPS_API
|
||||
GType vips_foreign_flags_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_FOREIGN_FLAGS (vips_foreign_flags_get_type())
|
||||
@ -120,7 +120,7 @@ GType vips_foreign_dz_container_get_type (void) G_GNUC_CONST;
|
||||
VIPS_API
|
||||
GType vips_foreign_heif_compression_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_FOREIGN_HEIF_COMPRESSION (vips_foreign_heif_compression_get_type())
|
||||
/* enumerations from "../../../libvips/include/vips/image.h" */
|
||||
/* enumerations from "image.h" */
|
||||
VIPS_API
|
||||
GType vips_demand_style_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_DEMAND_STYLE (vips_demand_style_get_type())
|
||||
@ -139,30 +139,30 @@ GType vips_coding_get_type (void) G_GNUC_CONST;
|
||||
VIPS_API
|
||||
GType vips_access_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_ACCESS (vips_access_get_type())
|
||||
/* enumerations from "../../../libvips/include/vips/morphology.h" */
|
||||
/* enumerations from "morphology.h" */
|
||||
VIPS_API
|
||||
GType vips_operation_morphology_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_OPERATION_MORPHOLOGY (vips_operation_morphology_get_type())
|
||||
/* enumerations from "../../../libvips/include/vips/object.h" */
|
||||
/* enumerations from "object.h" */
|
||||
VIPS_API
|
||||
GType vips_argument_flags_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_ARGUMENT_FLAGS (vips_argument_flags_get_type())
|
||||
/* enumerations from "../../../libvips/include/vips/operation.h" */
|
||||
/* enumerations from "operation.h" */
|
||||
VIPS_API
|
||||
GType vips_operation_flags_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_OPERATION_FLAGS (vips_operation_flags_get_type())
|
||||
/* enumerations from "../../../libvips/include/vips/region.h" */
|
||||
/* enumerations from "region.h" */
|
||||
VIPS_API
|
||||
GType vips_region_shrink_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_REGION_SHRINK (vips_region_shrink_get_type())
|
||||
/* enumerations from "../../../libvips/include/vips/resample.h" */
|
||||
/* enumerations from "resample.h" */
|
||||
VIPS_API
|
||||
GType vips_kernel_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_KERNEL (vips_kernel_get_type())
|
||||
VIPS_API
|
||||
GType vips_size_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_SIZE (vips_size_get_type())
|
||||
/* enumerations from "../../../libvips/include/vips/util.h" */
|
||||
/* enumerations from "util.h" */
|
||||
VIPS_API
|
||||
GType vips_token_get_type (void) G_GNUC_CONST;
|
||||
#define VIPS_TYPE_TOKEN (vips_token_get_type())
|
||||
|
@ -7,7 +7,7 @@ G_BEGIN_DECLS
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
/* enumerations from "@filename@" */
|
||||
/* enumerations from "@basename@" */
|
||||
/*** END file-production ***/
|
||||
|
||||
/*** BEGIN value-header ***/
|
||||
|
@ -8,16 +8,16 @@
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
/* enumerations from "@filename@" */
|
||||
/* enumerations from "@basename@" */
|
||||
/*** END file-production ***/
|
||||
|
||||
/*** BEGIN value-header ***/
|
||||
GType
|
||||
@enum_name@_get_type( void )
|
||||
{
|
||||
static GType etype = 0;
|
||||
static gsize gtype_id = 0;
|
||||
|
||||
if( etype == 0 ) {
|
||||
if( g_once_init_enter ( >ype_id ) ) {
|
||||
static const G@Type@Value values[] = {
|
||||
/*** END value-header ***/
|
||||
|
||||
@ -28,10 +28,12 @@ GType
|
||||
/*** BEGIN value-tail ***/
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
etype = g_@type@_register_static( "@EnumName@", values );
|
||||
|
||||
GType new_type =
|
||||
g_@type@_register_static( g_intern_static_string( "@EnumName@" ), values );
|
||||
g_once_init_leave( >ype_id, new_type );
|
||||
}
|
||||
|
||||
return( etype );
|
||||
return( (GType) gtype_id );
|
||||
}
|
||||
/*** END value-tail ***/
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user