summaryrefslogtreecommitdiffstats
path: root/src/message.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-06-24 23:01:23 +0000
committerBram Moolenaar <Bram@vim.org>2005-06-24 23:01:23 +0000
commit0a5fe2140db2e6688a7ef42031a21d8293038715 (patch)
treec4a543636157a7e148ef789201f0f6373f8b548e /src/message.c
parentc4def13f8bc6631add3b10bb84783acca72795ae (diff)
updated for version 7.0092
Diffstat (limited to 'src/message.c')
-rw-r--r--src/message.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/message.c b/src/message.c
index 535d65a51a..a43cb9287f 100644
--- a/src/message.c
+++ b/src/message.c
@@ -743,13 +743,8 @@ add_msg_hist(s, len, attr)
/* Don't let the message history get too big */
while (msg_hist_len > 20)
- {
- p = first_msg_hist;
- first_msg_hist = p->next;
- vim_free(p->msg);
- vim_free(p);
- --msg_hist_len;
- }
+ (void)delete_first_msg();
+
/* allocate an entry and add the message at the end of the history */
p = (struct msg_hist *)alloc((int)sizeof(struct msg_hist));
if (p != NULL)
@@ -777,6 +772,25 @@ add_msg_hist(s, len, attr)
}
/*
+ * Delete the first (oldest) message from the history.
+ * Returns FAIL if there are no messages.
+ */
+ int
+delete_first_msg()
+{
+ struct msg_hist *p;
+
+ if (msg_hist_len <= 0)
+ return FAIL;
+ p = first_msg_hist;
+ first_msg_hist = p->next;
+ vim_free(p->msg);
+ vim_free(p);
+ --msg_hist_len;
+ return OK;
+}
+
+/*
* ":messages" command.
*/
/*ARGSUSED*/