[libsoup] Don't use the reserved keyword 'interface'
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] Don't use the reserved keyword 'interface'
- Date: Sun, 28 Aug 2011 00:55:58 +0000 (UTC)
commit 916ccf31b237cc668f2222e325d81d0b212014b8
Author: Erik van Pienbroek <erik vanpienbroek nl>
Date: Fri Aug 12 15:58:51 2011 +0200
Don't use the reserved keyword 'interface'
On Win32 environments, the keyword 'interface' is a reserved keyword. Up
until now a hack was applied in soup-portability.h to '#undef interface'
so that various pieces of libsoup could use that keyword. However, due
to a recent change in the mingw-w64 toolchain this #undef causes more
breakage while #include'ing other Win32 headers.
As the keyword 'interface' is a reserved keyword on Win32, applications
or libraries shouldn't be messing around with that. This patch changes
various parts of libsoup where the keyword 'interface' is used as name
for variables. These variables have been renamed to 'iface'. Due to this
rename, the #undef hack can be dropped and libsoup can be compiled
cleanly against the latest mingw-w64 toolchain
https://bugzilla.gnome.org/show_bug.cgi?id=656402
libsoup/soup-portability.h | 2 --
libsoup/soup-proxy-resolver.c | 12 ++++++------
libsoup/soup-server.c | 32 ++++++++++++++++----------------
3 files changed, 22 insertions(+), 24 deletions(-)
---
diff --git a/libsoup/soup-portability.h b/libsoup/soup-portability.h
index b36e7d7..1814efb 100644
--- a/libsoup/soup-portability.h
+++ b/libsoup/soup-portability.h
@@ -11,8 +11,6 @@
#ifdef G_OS_WIN32
#include <winsock2.h>
-#undef interface
-
#include <ws2tcpip.h>
#else
diff --git a/libsoup/soup-proxy-resolver.c b/libsoup/soup-proxy-resolver.c
index 37a3b19..c356ab1 100644
--- a/libsoup/soup-proxy-resolver.c
+++ b/libsoup/soup-proxy-resolver.c
@@ -16,7 +16,7 @@
#include "soup-session-feature.h"
#include "soup-uri.h"
-static void soup_proxy_resolver_interface_init (GTypeInterface *interface);
+static void soup_proxy_resolver_interface_init (GTypeInterface *iface);
static void soup_proxy_resolver_uri_resolver_interface_init (SoupProxyURIResolverInterface *uri_resolver_interface);
GType
@@ -43,19 +43,19 @@ soup_proxy_resolver_get_type (void)
static void
proxy_resolver_interface_check (gpointer func_data, gpointer g_iface)
{
- GTypeInterface *interface = g_iface;
+ GTypeInterface *iface = g_iface;
- if (interface->g_type != SOUP_TYPE_PROXY_RESOLVER)
+ if (iface->g_type != SOUP_TYPE_PROXY_RESOLVER)
return;
/* If the class hasn't already declared that it implements
* SoupProxyURIResolver, add our own compat implementation.
*/
- if (!g_type_is_a (interface->g_instance_type, SOUP_TYPE_PROXY_URI_RESOLVER)) {
+ if (!g_type_is_a (iface->g_instance_type, SOUP_TYPE_PROXY_URI_RESOLVER)) {
const GInterfaceInfo uri_resolver_interface_info = {
(GInterfaceInitFunc) soup_proxy_resolver_uri_resolver_interface_init, NULL, NULL
};
- g_type_add_interface_static (interface->g_instance_type,
+ g_type_add_interface_static (iface->g_instance_type,
SOUP_TYPE_PROXY_URI_RESOLVER,
&uri_resolver_interface_info);
}
@@ -63,7 +63,7 @@ proxy_resolver_interface_check (gpointer func_data, gpointer g_iface)
static void
-soup_proxy_resolver_interface_init (GTypeInterface *interface)
+soup_proxy_resolver_interface_init (GTypeInterface *iface)
{
/* Add an interface_check where we can kludgily add the
* SoupProxyURIResolver interface to all SoupProxyResolvers.
diff --git a/libsoup/soup-server.c b/libsoup/soup-server.c
index 7225337..92bcc50 100644
--- a/libsoup/soup-server.c
+++ b/libsoup/soup-server.c
@@ -95,7 +95,7 @@ typedef struct {
} SoupServerHandler;
typedef struct {
- SoupAddress *interface;
+ SoupAddress *iface;
guint port;
char *ssl_cert_file, *ssl_key_file;
@@ -164,8 +164,8 @@ finalize (GObject *object)
SoupServerPrivate *priv = SOUP_SERVER_GET_PRIVATE (server);
GSList *iter;
- if (priv->interface)
- g_object_unref (priv->interface);
+ if (priv->iface)
+ g_object_unref (priv->iface);
g_free (priv->ssl_cert_file);
g_free (priv->ssl_key_file);
@@ -462,8 +462,8 @@ constructor (GType type,
return NULL;
priv = SOUP_SERVER_GET_PRIVATE (server);
- if (!priv->interface) {
- priv->interface =
+ if (!priv->iface) {
+ priv->iface =
soup_address_new_any (SOUP_ADDRESS_FAMILY_IPV4,
priv->port);
}
@@ -479,7 +479,7 @@ constructor (GType type,
}
priv->listen_sock =
- soup_socket_new (SOUP_SOCKET_LOCAL_ADDRESS, priv->interface,
+ soup_socket_new (SOUP_SOCKET_LOCAL_ADDRESS, priv->iface,
SOUP_SOCKET_SSL_CREDENTIALS, priv->ssl_creds,
SOUP_SOCKET_ASYNC_CONTEXT, priv->async_context,
NULL);
@@ -491,10 +491,10 @@ constructor (GType type,
/* Re-resolve the interface address, in particular in case
* the passed-in address had SOUP_ADDRESS_ANY_PORT.
*/
- g_object_unref (priv->interface);
- priv->interface = soup_socket_get_local_address (priv->listen_sock);
- g_object_ref (priv->interface);
- priv->port = soup_address_get_port (priv->interface);
+ g_object_unref (priv->iface);
+ priv->iface = soup_socket_get_local_address (priv->listen_sock);
+ g_object_ref (priv->iface);
+ priv->port = soup_address_get_port (priv->iface);
return server;
}
@@ -511,11 +511,11 @@ set_property (GObject *object, guint prop_id,
priv->port = g_value_get_uint (value);
break;
case PROP_INTERFACE:
- if (priv->interface)
- g_object_unref (priv->interface);
- priv->interface = g_value_get_object (value);
- if (priv->interface)
- g_object_ref (priv->interface);
+ if (priv->iface)
+ g_object_unref (priv->iface);
+ priv->iface = g_value_get_object (value);
+ if (priv->iface)
+ g_object_ref (priv->iface);
break;
case PROP_SSL_CERT_FILE:
priv->ssl_cert_file =
@@ -565,7 +565,7 @@ get_property (GObject *object, guint prop_id,
g_value_set_uint (value, priv->port);
break;
case PROP_INTERFACE:
- g_value_set_object (value, priv->interface);
+ g_value_set_object (value, priv->iface);
break;
case PROP_SSL_CERT_FILE:
g_value_set_string (value, priv->ssl_cert_file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]