[anjuta/git-shell: 20/26] git: Clear the arguments list after executing a command.
- From: James Liggett <jrliggett src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta/git-shell: 20/26] git: Clear the arguments list after executing a command.
- Date: Tue, 18 May 2010 02:00:39 +0000 (UTC)
commit bf4580bb78c07609df10648d074decdaba2560be
Author: James Liggett <jrliggett cox net>
Date: Mon May 17 14:23:36 2010 -0700
git: Clear the arguments list after executing a command.
Clearing the arguments list in GitCommand allows commands to be used more than
once per instance.
plugins/git/git-command.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/plugins/git/git-command.c b/plugins/git/git-command.c
index a6f322e..39f34f4 100644
--- a/plugins/git/git-command.c
+++ b/plugins/git/git-command.c
@@ -317,6 +317,14 @@ git_command_error_handler (GitCommand *self, const gchar *output)
}
static void
+git_command_clear_args_list (GitCommand *self)
+{
+ g_list_foreach (self->priv->args, (GFunc) g_free, NULL);
+ g_list_free (self->priv->args);
+ self->priv->args = NULL;
+}
+
+static void
git_command_child_exited (AnjutaLauncher *launcher, gint child_pid, gint status,
gulong time, GitCommand *self)
{
@@ -325,6 +333,9 @@ git_command_child_exited (AnjutaLauncher *launcher, gint child_pid, gint status,
anjuta_command_set_error_message (ANJUTA_COMMAND (self),
self->priv->error_string->str);
}
+
+ /* Clear the argument list to make the command reusable */
+ git_command_clear_args_list (self);
anjuta_command_notify_complete (ANJUTA_COMMAND (self),
(guint) WEXITSTATUS (status));
@@ -352,18 +363,11 @@ static void
git_command_finalize (GObject *object)
{
GitCommand *self;
- GList *current_arg;
GList *current_info;
self = GIT_COMMAND (object);
- current_arg = self->priv->args;
-
- while (current_arg)
- {
- g_free (current_arg->data);
- current_arg = g_list_next (current_arg);
- }
+ git_command_clear_args_list (self);
current_info = self->priv->info_queue->head;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]