[gtksourceview] UndoManagerDefault: don't use the INVALID action
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] UndoManagerDefault: don't use the INVALID action
- Date: Mon, 25 Feb 2013 17:47:03 +0000 (UTC)
commit c3714f374a70c3c2ab488932919c886dff92aac1
Author: Sébastien Wilmet <swilmet gnome org>
Date: Mon Feb 25 17:38:34 2013 +0100
UndoManagerDefault: don't use the INVALID action
An INVALID action was used to distinguish from a NULL action in the
'modified_action' struct field.
But using NULL instead of INVALID works fine. The only place where an
INVALID value would make a different result is in
modified_changed_handler():
if (manager->priv->modified_action != NULL)
{
g_message ("%s: oops", G_STRLOC);
return;
}
If the rest of the code is correct, it doesn't change anything.
https://bugzilla.gnome.org/show_bug.cgi?id=694613
gtksourceview/gtksourceundomanagerdefault.c | 17 +++++------------
1 files changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/gtksourceview/gtksourceundomanagerdefault.c b/gtksourceview/gtksourceundomanagerdefault.c
index 34860b0..af3df98 100644
--- a/gtksourceview/gtksourceundomanagerdefault.c
+++ b/gtksourceview/gtksourceundomanagerdefault.c
@@ -108,9 +108,6 @@ struct _GtkSourceUndoAction
guint modified : 1;
};
-/* INVALID is a pointer to an invalid action */
-#define INVALID ((void *) "IA")
-
enum
{
INSERT_TEXT,
@@ -141,9 +138,7 @@ struct _GtkSourceUndoManagerDefaultPrivate
guint modified_undoing_group : 1;
/* Pointer to the action (in the action list) marked as "modified".
- * It is NULL when no action is marked as "modified".
- * It is INVALID when the action marked as "modified" has been removed
- * from the action list (freeing the list or resizing it) */
+ * It is NULL when no action is marked as "modified". */
GtkSourceUndoAction *modified_action;
guint buffer_signals[NUM_SIGNALS];
@@ -815,7 +810,7 @@ free_action_list (GtkSourceUndoManagerDefault *um)
--um->priv->num_of_groups;
if (action->modified)
- um->priv->modified_action = INVALID;
+ um->priv->modified_action = NULL;
gtk_source_undo_action_free (action);
}
@@ -1001,7 +996,7 @@ free_first_n_actions (GtkSourceUndoManagerDefault *um,
--um->priv->num_of_groups;
if (action->modified)
- um->priv->modified_action = INVALID;
+ um->priv->modified_action = NULL;
gtk_source_undo_action_free (action);
@@ -1034,7 +1029,7 @@ check_list_size (GtkSourceUndoManagerDefault *um)
--um->priv->num_of_groups;
if (undo_action->modified)
- um->priv->modified_action = INVALID;
+ um->priv->modified_action = NULL;
gtk_source_undo_action_free (undo_action);
@@ -1194,9 +1189,7 @@ modified_changed_handler (GtkTextBuffer *buffer,
if (manager->priv->modified_action != NULL)
{
- if (manager->priv->modified_action != INVALID)
- manager->priv->modified_action->modified = FALSE;
-
+ manager->priv->modified_action->modified = FALSE;
manager->priv->modified_action = NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]