[glib] Remove unneccessary variable from g_cancellable_cancel()
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Remove unneccessary variable from g_cancellable_cancel()
- Date: Mon, 29 Mar 2010 18:00:58 +0000 (UTC)
commit 5527a2ac2ce2b5bea10867fb2e39d2f1914cfbe6
Author: Benjamin Otte <otte redhat com>
Date: Fri Mar 26 20:36:10 2010 +0100
Remove unneccessary variable from g_cancellable_cancel()
The variable makes a complicated function even more complicated.
gio/gcancellable.c | 25 ++++++++++---------------
1 files changed, 10 insertions(+), 15 deletions(-)
---
diff --git a/gio/gcancellable.c b/gio/gcancellable.c
index 07b61b7..2d600c9 100644
--- a/gio/gcancellable.c
+++ b/gio/gcancellable.c
@@ -613,7 +613,6 @@ g_cancellable_release_fd (GCancellable *cancellable)
void
g_cancellable_cancel (GCancellable *cancellable)
{
- gboolean cancel;
GCancellablePrivate *priv;
if (cancellable == NULL ||
@@ -621,10 +620,9 @@ g_cancellable_cancel (GCancellable *cancellable)
return;
priv = cancellable->priv;
- cancel = FALSE;
G_LOCK(cancellable);
- cancel = TRUE;
+
priv->cancelled = TRUE;
priv->cancelled_running = TRUE;
#ifdef G_OS_WIN32
@@ -642,22 +640,19 @@ g_cancellable_cancel (GCancellable *cancellable)
}
G_UNLOCK(cancellable);
- if (cancel)
- {
- g_object_ref (cancellable);
- g_signal_emit (cancellable, signals[CANCELLED], 0);
+ g_object_ref (cancellable);
+ g_signal_emit (cancellable, signals[CANCELLED], 0);
- G_LOCK(cancellable);
+ G_LOCK(cancellable);
- priv->cancelled_running = FALSE;
- if (priv->cancelled_running_waiting)
- g_cond_broadcast (cancellable_cond);
- priv->cancelled_running_waiting = FALSE;
+ priv->cancelled_running = FALSE;
+ if (priv->cancelled_running_waiting)
+ g_cond_broadcast (cancellable_cond);
+ priv->cancelled_running_waiting = FALSE;
- G_UNLOCK(cancellable);
+ G_UNLOCK(cancellable);
- g_object_unref (cancellable);
- }
+ g_object_unref (cancellable);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]