summaryrefslogtreecommitdiffstats
path: root/history.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>2000-01-10 10:35:48 +0000
committerThomas Roessler <roessler@does-not-exist.org>2000-01-10 10:35:48 +0000
commit544e8ba393e9c1ca55b120f209383742211007c8 (patch)
tree5157baa0f2071aa0763254491475416832cdf991 /history.c
parentc8e19c984e900ede0f0c09353a96c62a6aa81445 (diff)
Add (and use) a function mutt_str_replace, which essentially
replaces the sequence: safe_free (&s); s = safe_strdup (t);
Diffstat (limited to 'history.c')
-rw-r--r--history.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/history.c b/history.c
index dfd2234e..f38b4969 100644
--- a/history.c
+++ b/history.c
@@ -79,8 +79,7 @@ void mutt_history_add (history_class_t hclass, const char *s)
if (prev < 0) prev = HistSize - 1;
if (!h->hist[prev] || mutt_strcmp (h->hist[prev], s) != 0)
{
- safe_free ((void **) &h->hist[h->last]);
- h->hist[h->last++] = safe_strdup (s);
+ mutt_str_replace (&h->hist[h->last++], s);
if (h->last > HistSize - 1)
h->last = 0;
}