summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJérémie Courrèges-Anglas <jca@wxcvbn.org>2013-04-10 16:31:37 +0200
committerJérémie Courrèges-Anglas <jca@wxcvbn.org>2013-04-10 16:31:37 +0200
commit5b323d2cd5fc711229f9acef46b1b4f9a9c2378a (patch)
tree9b00b9d91bbe79266d2388b8ad0b0ae6e4ed6176 /src
parenta31ee19ed7861dae004451df2c1cea84c45092ed (diff)
downloadratpoison-5b323d2cd5fc711229f9acef46b1b4f9a9c2378a.zip
free_bar: make this function reusable
* set last_msg to NULL after freeing it * no need to test for last_msg being NULL before freeing it (likewise in update_last_message)
Diffstat (limited to 'src')
-rw-r--r--src/bar.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/bar.c b/src/bar.c
index ef72a87..8af3308 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -531,8 +531,7 @@ draw_mark (rp_screen *s, char *msg, int mark_start, int mark_end)
static void
update_last_message (char *msg, int mark_start, int mark_end)
{
- if (last_msg)
- free (last_msg);
+ free (last_msg);
last_msg = xstrdup (msg);
last_mark_start = mark_start;
last_mark_end = mark_end;
@@ -603,6 +602,6 @@ show_last_message (void)
void
free_bar (void)
{
- if (last_msg)
- free (last_msg);
+ free (last_msg);
+ last_msg = NULL;
}