* Since: 2.24
**/
-GType
-soup_cookie_get_type (void)
-{
- static volatile gsize type_volatile = 0;
-
- if (g_once_init_enter (&type_volatile)) {
- GType type = g_boxed_type_register_static (
- g_intern_static_string ("SoupCookie"),
- (GBoxedCopyFunc) soup_cookie_copy,
- (GBoxedFreeFunc) soup_cookie_free);
- g_once_init_leave (&type_volatile, type);
- }
- return type_volatile;
-}
+G_DEFINE_BOXED_TYPE (SoupCookie, soup_cookie, soup_cookie_copy, soup_cookie_free)
/**
* soup_cookie_copy:
return nonleap_days_in_month[month];
}
-GType
-soup_date_get_type (void)
-{
- static volatile gsize type_volatile = 0;
-
- if (g_once_init_enter (&type_volatile)) {
- GType type = g_boxed_type_register_static (
- g_intern_static_string ("SoupDate"),
- (GBoxedCopyFunc) soup_date_copy,
- (GBoxedFreeFunc) soup_date_free);
- g_once_init_leave (&type_volatile, type);
- }
- return type_volatile;
-}
+G_DEFINE_BOXED_TYPE (SoupDate, soup_date, soup_date_copy, soup_date_free)
static void
soup_date_fixup (SoupDate *date)
copy);
}
-GType
-soup_buffer_get_type (void)
-{
- static volatile gsize type_volatile = 0;
-
- if (g_once_init_enter (&type_volatile)) {
- GType type = g_boxed_type_register_static (
- g_intern_static_string ("SoupBuffer"),
- (GBoxedCopyFunc) soup_buffer_copy,
- (GBoxedFreeFunc) soup_buffer_free);
- g_once_init_leave (&type_volatile, type);
- }
- return type_volatile;
-}
+G_DEFINE_BOXED_TYPE (SoupBuffer, soup_buffer, soup_buffer_copy, soup_buffer_free)
/**
}
}
-GType
-soup_message_body_get_type (void)
-{
- static volatile gsize type_volatile = 0;
-
- if (g_once_init_enter (&type_volatile)) {
- GType type = g_boxed_type_register_static (
- g_intern_static_string ("SoupMessageBody"),
- (GBoxedCopyFunc) soup_message_body_copy,
- (GBoxedFreeFunc) soup_message_body_free);
- g_once_init_leave (&type_volatile, type);
- }
- return type_volatile;
-}
+G_DEFINE_BOXED_TYPE (SoupMessageBody, soup_message_body, soup_message_body_copy, soup_message_body_free)
}
}
-GType
-soup_message_headers_get_type (void)
-{
- static volatile gsize type_volatile = 0;
-
- if (g_once_init_enter (&type_volatile)) {
- GType type = g_boxed_type_register_static (
- g_intern_static_string ("SoupMessageHeaders"),
- (GBoxedCopyFunc) soup_message_headers_copy,
- (GBoxedFreeFunc) soup_message_headers_free);
- g_once_init_leave (&type_volatile, type);
- }
- return type_volatile;
-}
+G_DEFINE_BOXED_TYPE (SoupMessageHeaders, soup_message_headers, soup_message_headers_copy, soup_message_headers_free)
/**
* soup_message_headers_clear:
return copy;
}
-GType
-soup_multipart_get_type (void)
-{
- static volatile gsize type_volatile = 0;
-
- if (g_once_init_enter (&type_volatile)) {
- GType type = g_boxed_type_register_static (
- g_intern_static_string ("SoupMultipart"),
- (GBoxedCopyFunc) soup_multipart_copy,
- (GBoxedFreeFunc) soup_multipart_free);
- g_once_init_leave (&type_volatile, type);
- }
- return type_volatile;
-}
+G_DEFINE_BOXED_TYPE (SoupMultipart, soup_multipart, soup_multipart_copy, soup_multipart_free)
#include "soup-password-manager.h"
#include "soup-session-feature.h"
-GType
-soup_password_manager_get_type (void)
+G_DEFINE_INTERFACE_WITH_CODE (SoupPasswordManager, soup_password_manager, G_TYPE_OBJECT,
+ g_type_interface_add_prerequisite (g_define_type_id, SOUP_TYPE_SESSION_FEATURE);
+ )
+
+static void
+soup_password_manager_default_init (SoupPasswordManagerInterface *iface)
{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile))
- {
- GType g_define_type_id =
- g_type_register_static_simple (G_TYPE_INTERFACE,
- g_intern_static_string ("SoupPasswordManager"),
- sizeof (SoupPasswordManagerInterface),
- (GClassInitFunc)NULL,
- 0,
- (GInstanceInitFunc)NULL,
- (GTypeFlags) 0);
- g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_OBJECT);
- g_type_interface_add_prerequisite (g_define_type_id, SOUP_TYPE_SESSION_FEATURE);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
}
/**
#include "soup-session-feature.h"
#include "soup-uri.h"
-static void soup_proxy_resolver_interface_init (GTypeInterface *iface);
+static void soup_proxy_resolver_default_init (SoupProxyResolverInterface *iface);
static void soup_proxy_resolver_uri_resolver_interface_init (SoupProxyURIResolverInterface *uri_resolver_interface);
-GType
-soup_proxy_resolver_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile))
- {
- GType g_define_type_id =
- g_type_register_static_simple (G_TYPE_INTERFACE,
- g_intern_static_string ("SoupProxyResolver"),
- sizeof (SoupProxyResolverInterface),
- (GClassInitFunc)soup_proxy_resolver_interface_init,
- 0,
- (GInstanceInitFunc)NULL,
- (GTypeFlags) 0);
- g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_OBJECT);
- g_type_interface_add_prerequisite (g_define_type_id, SOUP_TYPE_SESSION_FEATURE);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
+G_DEFINE_INTERFACE_WITH_CODE (SoupProxyResolver, soup_proxy_resolver, G_TYPE_OBJECT,
+ g_type_interface_add_prerequisite (g_define_type_id, SOUP_TYPE_SESSION_FEATURE);
+ )
static void
proxy_resolver_interface_check (gpointer func_data, gpointer g_iface)
static void
-soup_proxy_resolver_interface_init (GTypeInterface *iface)
+soup_proxy_resolver_default_init (SoupProxyResolverInterface *iface)
{
/* Add an interface_check where we can kludgily add the
* SoupProxyURIResolver interface to all SoupProxyResolvers.
#include "soup-proxy-uri-resolver.h"
#include "soup-session-feature.h"
-GType
-soup_proxy_uri_resolver_get_type (void)
+G_DEFINE_INTERFACE (SoupProxyURIResolver, soup_proxy_uri_resolver, G_TYPE_OBJECT)
+
+static void
+soup_proxy_uri_resolver_default_init (SoupProxyURIResolverInterface *iface)
{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile))
- {
- GType g_define_type_id =
- g_type_register_static_simple (G_TYPE_INTERFACE,
- g_intern_static_string ("SoupProxyURIResolver"),
- sizeof (SoupProxyURIResolverInterface),
- (GClassInitFunc)NULL,
- 0,
- (GInstanceInitFunc)NULL,
- (GTypeFlags) 0);
- g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_OBJECT);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
}
/**
* also be of use in some situations (eg, tracking when multiple
* requests are made on the same connection).
**/
-GType
-soup_client_context_get_type (void)
-{
- static volatile gsize type_volatile = 0;
-
- if (g_once_init_enter (&type_volatile)) {
- GType type = g_boxed_type_register_static (
- g_intern_static_string ("SoupClientContext"),
- (GBoxedCopyFunc) soup_client_context_ref,
- (GBoxedFreeFunc) soup_client_context_unref);
- g_once_init_leave (&type_volatile, type);
- }
- return type_volatile;
-}
+G_DEFINE_BOXED_TYPE (SoupClientContext, soup_client_context, soup_client_context_ref, soup_client_context_unref)
/**
* soup_client_context_get_socket:
* Since: 2.24
**/
-static void soup_session_feature_interface_init (SoupSessionFeatureInterface *interface);
+static void soup_session_feature_default_init (SoupSessionFeatureInterface *interface);
static void attach (SoupSessionFeature *feature, SoupSession *session);
static void detach (SoupSessionFeature *feature, SoupSession *session);
-GType
-soup_session_feature_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile))
- {
- GType g_define_type_id =
- g_type_register_static_simple (G_TYPE_INTERFACE,
- g_intern_static_string ("SoupSessionFeature"),
- sizeof (SoupSessionFeatureInterface),
- (GClassInitFunc)soup_session_feature_interface_init,
- 0,
- (GInstanceInitFunc)NULL,
- (GTypeFlags) 0);
- g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_OBJECT);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
+G_DEFINE_INTERFACE (SoupSessionFeature, soup_session_feature, G_TYPE_OBJECT)
static void
-soup_session_feature_interface_init (SoupSessionFeatureInterface *interface)
+soup_session_feature_default_init (SoupSessionFeatureInterface *interface)
{
interface->attach = attach;
interface->detach = detach;
return g_ascii_strcasecmp (one->host, two->host) == 0;
}
-
-GType
-soup_uri_get_type (void)
-{
- static volatile gsize type_volatile = 0;
-
- if (g_once_init_enter (&type_volatile)) {
- GType type = g_boxed_type_register_static (
- g_intern_static_string ("SoupURI"),
- (GBoxedCopyFunc) soup_uri_copy,
- (GBoxedFreeFunc) soup_uri_free);
- g_once_init_leave (&type_volatile, type);
- }
- return type_volatile;
-}
+G_DEFINE_BOXED_TYPE (SoupURI, soup_uri, soup_uri_copy, soup_uri_free)
/**
* SOUP_TYPE_BYTE_ARRAY:
*
- * glib does not define a #GType for #GByteArray, so libsoup
+ * glib did not used to define a #GType for #GByteArray, so libsoup
* defines this one itself.
**/
-GType
-soup_byte_array_get_type (void)
-{
- static volatile gsize type_volatile = 0;
-
- if (g_once_init_enter (&type_volatile)) {
- GType type = g_boxed_type_register_static (
- g_intern_static_string ("SoupByteArray"),
- (GBoxedCopyFunc) soup_byte_array_copy,
- (GBoxedFreeFunc) soup_byte_array_free);
- g_once_init_leave (&type_volatile, type);
- }
- return type_volatile;
-}
+typedef GByteArray SoupByteArray;
+G_DEFINE_BOXED_TYPE (SoupByteArray, soup_byte_array, soup_byte_array_copy, soup_byte_array_free)