diff --git a/libvips/iofuncs/operation.c b/libvips/iofuncs/operation.c index 5b740f4870..f8adf74802 100644 --- a/libvips/iofuncs/operation.c +++ b/libvips/iofuncs/operation.c @@ -292,14 +292,9 @@ vips_operation_class_usage_classify(VipsArgumentClass *argument_class) /* Display a set of flags as "a:b:c" */ static void -vips__flags_to_str(VipsBuf *buf, GType type, guint value) +vips__flags_to_str(VipsBuf *buf, GFlagsClass *flags, guint value) { - GTypeClass *class = g_type_class_ref(type); - GFlagsClass *flags = G_FLAGS_CLASS(class); - - gboolean first; - - first = TRUE; + gboolean first = TRUE; for (int i = 0; i < flags->n_values; i++) // can't be 0 (would match everything), and all bits // should match all bits in the value, or "all" would always match @@ -321,18 +316,14 @@ vips_operation_pspec_usage(VipsBuf *buf, GParamSpec *pspec) /* These are the pspecs that vips uses that have interesting values. */ if (G_IS_PARAM_SPEC_ENUM(pspec)) { - GTypeClass *class = g_type_class_ref(type); + /* GParamSpecEnum holds a ref on the class so we just peek. + */ + GEnumClass *genum = g_type_class_peek(type); GParamSpecEnum *pspec_enum = (GParamSpecEnum *) pspec; - GEnumClass *genum; int i; - /* Should be impossible, no need to warn. - */ - if (!class) - return; - - genum = G_ENUM_CLASS(class); + g_assert(genum); vips_buf_appendf(buf, "\t\t\t"); vips_buf_appendf(buf, "%s", _("default enum")); @@ -351,23 +342,19 @@ vips_operation_pspec_usage(VipsBuf *buf, GParamSpec *pspec) vips_buf_appendf(buf, "\n"); } if (G_IS_PARAM_SPEC_FLAGS(pspec)) { - GTypeClass *class = g_type_class_ref(type); + /* GParamSpecFlags holds a ref on the class so we just peek. + */ + GFlagsClass *gflags = g_type_class_peek(type); GParamSpecFlags *pspec_flags = (GParamSpecFlags *) pspec; - GFlagsClass *gflags; int i; - /* Should be impossible, no need to warn. - */ - if (!class) - return; - - gflags = G_FLAGS_CLASS(class); + g_assert(gflags); vips_buf_appendf(buf, "\t\t\t"); vips_buf_appendf(buf, "%s", _("default flags")); vips_buf_appendf(buf, ": "); - vips__flags_to_str(buf, type, pspec_flags->default_value); + vips__flags_to_str(buf, gflags, pspec_flags->default_value); vips_buf_appendf(buf, "\n"); vips_buf_appendf(buf, "\t\t\t"); vips_buf_appendf(buf, "%s", _("allowed flags")); diff --git a/tools/vips.c b/tools/vips.c index 4ec35c148e..5ea7200e85 100644 --- a/tools/vips.c +++ b/tools/vips.c @@ -216,17 +216,13 @@ list_operation_arg(VipsObjectClass *object_class, /* These are the pspecs that vips uses that have interesting values. */ if (G_IS_PARAM_SPEC_ENUM(pspec)) { - GTypeClass *class = g_type_class_ref(type); + /* GParamSpecEnum holds a ref on the class so we just peek. + */ + GEnumClass *genum = g_type_class_peek(type); - GEnumClass *genum; int i; - /* Should be impossible, no need to warn. - */ - if (!class) - return NULL; - - genum = G_ENUM_CLASS(class); + g_assert(genum); printf("word:"); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy