summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <pwithnall@endlessos.org>2023-03-30 12:02:40 +0100
committerPhilip Withnall <pwithnall@endlessos.org>2023-04-27 12:23:25 +0100
commit6e499764e4a4bab98fcd799f0395917367b114b1 (patch)
tree4932862d061b7151a03d8640b2e38d1463fe8014
parentbf92bae481be3619c8102340bdf8402f4827586d (diff)
downloadglib-6e499764e4a4bab98fcd799f0395917367b114b1.tar.gz
gthreadedresolver: Port to G_DECLARE_FINAL_TYPE
The class and its header are not public, so this should not be an API or ABI break. This just simplifies the code a little and allows for easy extension of the object’s private data in future commits. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
-rw-r--r--gio/gthreadedresolver.c4
-rw-r--r--gio/gthreadedresolver.h25
2 files changed, 14 insertions, 15 deletions
diff --git a/gio/gthreadedresolver.c b/gio/gthreadedresolver.c
index 021409d3c..2fa683fe8 100644
--- a/gio/gthreadedresolver.c
+++ b/gio/gthreadedresolver.c
@@ -38,6 +38,10 @@
#include "gsocketaddress.h"
#include "gsrvtarget.h"
+struct _GThreadedResolver
+{
+ GResolver parent_instance;
+};
G_DEFINE_TYPE (GThreadedResolver, g_threaded_resolver, G_TYPE_RESOLVER)
diff --git a/gio/gthreadedresolver.h b/gio/gthreadedresolver.h
index ea76e4bfd..099df5b84 100644
--- a/gio/gthreadedresolver.h
+++ b/gio/gthreadedresolver.h
@@ -21,28 +21,23 @@
#ifndef __G_THREADED_RESOLVER_H__
#define __G_THREADED_RESOLVER_H__
+#include <gio/gio.h>
#include <gio/gresolver.h>
G_BEGIN_DECLS
+/**
+ * GThreadedResolver:
+ *
+ * #GThreadedResolver is an implementation of #GResolver which calls the libc
+ * lookup functions in threads to allow them to run asynchronously.
+ *
+ * Since: 2.20
+ */
#define G_TYPE_THREADED_RESOLVER (g_threaded_resolver_get_type ())
-#define G_THREADED_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_THREADED_RESOLVER, GThreadedResolver))
-#define G_THREADED_RESOLVER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_THREADED_RESOLVER, GThreadedResolverClass))
-#define G_IS_THREADED_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_THREADED_RESOLVER))
-#define G_IS_THREADED_RESOLVER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_THREADED_RESOLVER))
-#define G_THREADED_RESOLVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_THREADED_RESOLVER, GThreadedResolverClass))
-
-typedef struct {
- GResolver parent_instance;
-} GThreadedResolver;
-
-typedef struct {
- GResolverClass parent_class;
-
-} GThreadedResolverClass;
GIO_AVAILABLE_IN_ALL
-GType g_threaded_resolver_get_type (void) G_GNUC_CONST;
+G_DECLARE_FINAL_TYPE (GThreadedResolver, g_threaded_resolver, G, THREADED_RESOLVER, GResolver)
/* Used for a private test API */
#ifdef G_OS_UNIX