mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-03 09:46:17 +01:00
gmain: remove unnecessary initialization of *timeout in prepare() callbacks
Note that the prepare callback only has one caller, which pre-initializes the timeout argument to -1. That may be an implementation detail and not publicly promised, but it wouldn't make sense to do it any other way in the caller. Also, note that g_unix_signal_watch_prepare() and the UNIX branch of g_child_watch_prepare() already relied on that.
This commit is contained in:
parent
30b5418608
commit
cdda194844
@ -4003,8 +4003,6 @@ socket_source_prepare (GSource *source,
|
|||||||
{
|
{
|
||||||
GSocketSource *socket_source = (GSocketSource *)source;
|
GSocketSource *socket_source = (GSocketSource *)source;
|
||||||
|
|
||||||
*timeout = -1;
|
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
if ((socket_source->pollfd.revents & G_IO_NVAL) != 0)
|
if ((socket_source->pollfd.revents & G_IO_NVAL) != 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -135,8 +135,6 @@ g_io_unix_prepare (GSource *source,
|
|||||||
GIOUnixWatch *watch = (GIOUnixWatch *)source;
|
GIOUnixWatch *watch = (GIOUnixWatch *)source;
|
||||||
GIOCondition buffer_condition = g_io_channel_get_buffer_condition (watch->channel);
|
GIOCondition buffer_condition = g_io_channel_get_buffer_condition (watch->channel);
|
||||||
|
|
||||||
*timeout = -1;
|
|
||||||
|
|
||||||
/* Only return TRUE here if _all_ bits in watch->condition will be set
|
/* Only return TRUE here if _all_ bits in watch->condition will be set
|
||||||
*/
|
*/
|
||||||
return ((watch->condition & buffer_condition) == watch->condition);
|
return ((watch->condition & buffer_condition) == watch->condition);
|
||||||
|
@ -709,8 +709,6 @@ g_io_win32_prepare (GSource *source,
|
|||||||
GIOWin32Channel *channel = (GIOWin32Channel *)watch->channel;
|
GIOWin32Channel *channel = (GIOWin32Channel *)watch->channel;
|
||||||
int event_mask;
|
int event_mask;
|
||||||
|
|
||||||
*timeout = -1;
|
|
||||||
|
|
||||||
if (channel->debug)
|
if (channel->debug)
|
||||||
g_print ("g_io_win32_prepare: source=%p channel=%p", source, channel);
|
g_print ("g_io_win32_prepare: source=%p channel=%p", source, channel);
|
||||||
|
|
||||||
|
@ -5510,7 +5510,6 @@ g_child_watch_prepare (GSource *source,
|
|||||||
gint *timeout)
|
gint *timeout)
|
||||||
{
|
{
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
*timeout = -1;
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#else /* G_OS_WIN32 */
|
#else /* G_OS_WIN32 */
|
||||||
{
|
{
|
||||||
|
@ -37,6 +37,8 @@ cb (gpointer data)
|
|||||||
static gboolean
|
static gboolean
|
||||||
prepare (GSource *source, gint *time)
|
prepare (GSource *source, gint *time)
|
||||||
{
|
{
|
||||||
|
g_assert_nonnull (time);
|
||||||
|
g_assert_cmpint (*time, ==, -1);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Loading…
Reference in New Issue
Block a user