mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-20 15:48:54 +02:00
gsocket: use check/prepare only on win32
There is no longer any code left in the check/prepare functions on UNIX, so put %NULL in the GSourceFuncs vtable. This also allows us to simplify some logic. https://bugzilla.gnome.org/show_bug.cgi?id=724707
This commit is contained in:
@@ -3213,31 +3213,26 @@ typedef struct {
|
|||||||
GIOCondition condition;
|
GIOCondition condition;
|
||||||
} GSocketSource;
|
} GSocketSource;
|
||||||
|
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
static gboolean
|
static gboolean
|
||||||
socket_source_prepare (GSource *source,
|
socket_source_prepare_win32 (GSource *source,
|
||||||
gint *timeout)
|
gint *timeout)
|
||||||
{
|
{
|
||||||
GSocketSource *socket_source = (GSocketSource *)source;
|
GSocketSource *socket_source = (GSocketSource *)source;
|
||||||
|
|
||||||
*timeout = -1;
|
*timeout = -1;
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
return (update_condition (socket_source->socket) & socket_source->condition) != 0;
|
||||||
socket_source->pollfd.revents = update_condition (socket_source->socket);
|
|
||||||
|
|
||||||
if ((socket_source->condition & socket_source->pollfd.revents) != 0)
|
|
||||||
return TRUE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
socket_source_check (GSource *source)
|
socket_source_check_win32 (GSource *source)
|
||||||
{
|
{
|
||||||
int timeout;
|
int timeout;
|
||||||
|
|
||||||
return socket_source_prepare (source, &timeout);
|
return socket_source_prepare_win32 (source, &timeout);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
socket_source_dispatch (GSource *source,
|
socket_source_dispatch (GSource *source,
|
||||||
@@ -3319,8 +3314,12 @@ socket_source_closure_callback (GSocket *socket,
|
|||||||
|
|
||||||
static GSourceFuncs socket_source_funcs =
|
static GSourceFuncs socket_source_funcs =
|
||||||
{
|
{
|
||||||
socket_source_prepare,
|
#ifdef G_OS_WIN32
|
||||||
socket_source_check,
|
socket_source_prepare_win32,
|
||||||
|
socket_source_check_win32,
|
||||||
|
#else
|
||||||
|
NULL, NULL, /* check, prepare */
|
||||||
|
#endif
|
||||||
socket_source_dispatch,
|
socket_source_dispatch,
|
||||||
socket_source_finalize,
|
socket_source_finalize,
|
||||||
(GSourceFunc)socket_source_closure_callback,
|
(GSourceFunc)socket_source_closure_callback,
|
||||||
|
Reference in New Issue
Block a user