summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsabetts <sabetts>2003-05-27 18:46:33 +0000
committersabetts <sabetts>2003-05-27 18:46:33 +0000
commitc590e039dac7c9edd4074d8e52f7928e789b5078 (patch)
tree3cf0673d90d641f5d386ea647c1b8078813a9214
parent416fd6f8a57877da6700bbb95008dacb84caf4e8 (diff)
downloadratpoison-c590e039dac7c9edd4074d8e52f7928e789b5078.zip
* src/completions.c (completions_next_completion): check
c->last_match as a match to partial on a virgin completion. * src/group.c (free_groups): new function * src/group.h (free_groups): new prototype * src/main.c (clean_up): call free_groups * src/actions.c (cmd_fdump): free the string returned by frame_dump. * src/completions.c (completions_update): free new_list.
-rw-r--r--ChangeLog13
-rw-r--r--src/actions.c6
-rw-r--r--src/completions.c18
-rw-r--r--src/group.c15
-rw-r--r--src/group.h2
-rw-r--r--src/main.c2
6 files changed, 52 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index ef35176..85a015c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2003-05-27 Shawn Betts <sabetts@sfu.ca>
+ * src/completions.c (completions_next_completion): check
+ c->last_match as a match to partial on a virgin completion.
+
+ * src/group.c (free_groups): new function
+
+ * src/group.h (free_groups): new prototype
+
+ * src/main.c (clean_up): call free_groups
+
+ * src/actions.c (cmd_fdump): free the string returned by frame_dump.
+
+ * src/completions.c (completions_update): free new_list.
+
* src/editor.c (input_line_free): free the completions structure
in line.
diff --git a/src/actions.c b/src/actions.c
index 8b2a04b..b96a279 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -3137,8 +3137,12 @@ cmd_fdump (int interactively, char *data)
/* FIXME: Oooh, gross! there's a trailing comma, yuk! */
list_for_each_entry (cur, &current_screen()->frames, node)
{
- sbuf_concat (s, frame_dump (cur));
+ char *tmp;
+
+ tmp = frame_dump (cur);
+ sbuf_concat (s, tmp);
sbuf_concat (s, ",");
+ free (tmp);
}
tmp = sbuf_get (s);
diff --git a/src/completions.c b/src/completions.c
index 970897d..6f2ed12 100644
--- a/src/completions.c
+++ b/src/completions.c
@@ -71,6 +71,9 @@ completions_update (rp_completions *c, char *partial)
c->partial = xstrdup (partial);
completions_assign (c, new_list);
+
+ /* Free the head structure for our list. */
+ free (new_list);
}
/* Return a completed string that starts with partial. */
@@ -80,11 +83,24 @@ completions_next_completion (rp_completions *c, char *partial)
struct sbuf *cur;
if (c->virgin)
- completions_update (c, partial);
+ {
+ completions_update (c, partial);
+
+ /* Since it's never been completed on and c->last_match points
+ to the first element of the list which may be a match. So
+ check it. FIXME: This is a bit of a hack. */
+ if (c->last_match == NULL)
+ return NULL;
+
+ if (str_comp (sbuf_get (c->last_match), c->partial, strlen (c->partial)))
+ return sbuf_get (c->last_match);
+ }
if (c->last_match == NULL)
return NULL;
+ /* */
+
/* search forward from our last match through the list looking for
another match. */
for (cur = list_next_entry (c->last_match, &c->completion_list, node);
diff --git a/src/group.c b/src/group.c
index b69212e..80ab89e 100644
--- a/src/group.c
+++ b/src/group.c
@@ -24,7 +24,8 @@
static struct numset *group_numset;
-void init_groups()
+void
+init_groups()
{
rp_group *g;
@@ -38,6 +39,18 @@ void init_groups()
list_add_tail (&g->node, &rp_groups);
}
+void
+free_groups()
+{
+ rp_group *cur;
+ struct list_head *iter, *tmp;
+
+ list_for_each_safe_entry (cur, iter, tmp, &rp_groups, node)
+ {
+ group_free (cur);
+ }
+}
+
rp_group *
group_new (int number, char *name)
{
diff --git a/src/group.h b/src/group.h
index 748c273..87b54af 100644
--- a/src/group.h
+++ b/src/group.h
@@ -2,6 +2,8 @@
#define GROUP_H
void init_groups ();
+void free_groups();
+
void group_add_window (rp_group *g, rp_window *w);
void group_resort_window (rp_group *g, rp_window_elem *w);
void group_free (rp_group *g);
diff --git a/src/main.c b/src/main.c
index 411fcac..0173ef4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -774,7 +774,7 @@ clean_up ()
free_keybindings ();
free_aliases ();
free_bar ();
-/* free_history (); */
+ free_groups ();
free_window_stuff ();