X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=history.c;h=92bdb9f6884f0c4abe21809819dca1d7527653bf;hp=14643456d1297e67500db5d9ab521b2015f86cd5;hb=77068dc751e2f57d7c635be4f77fd18f30ae3f0e;hpb=df70e07e24add1869bcc9b7af2277d9d0c09a281 diff --git a/history.c b/history.c index 1464345..92bdb9f 100644 --- a/history.c +++ b/history.c @@ -1,25 +1,18 @@ /* + * Copyright notice from original mutt: * Copyright (C) 1996-2000 Michael R. Elkins - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * + * This file is part of mutt-ng, see http://www.muttng.org/. + * It's licensed under the GNU General Public License, + * please see the file GPL in the top level source directory. */ #if HAVE_CONFIG_H # include "config.h" #endif +#include + #include "mutt.h" #include "history.h" @@ -41,13 +34,13 @@ static void init_history (struct history *h) if (OldSize) { if (h->hist) { for (i = 0; i < OldSize; i++) - FREE (&h->hist[i]); - FREE (&h->hist); + p_delete(&h->hist[i]); + p_delete(&h->hist); } } if (HistSize) - h->hist = safe_calloc (HistSize, sizeof (char *)); + h->hist = p_new(char *, HistSize); h->cur = 0; h->last = 0; @@ -78,8 +71,8 @@ void mutt_history_add (history_class_t hclass, const char *s) prev = h->last - 1; if (prev < 0) prev = HistSize - 1; - if (!h->hist[prev] || mutt_strcmp (h->hist[prev], s) != 0) { - mutt_str_replace (&h->hist[h->last++], s); + if (!h->hist[prev] || m_strcmp(h->hist[prev], s) != 0) { + m_strreplace(&h->hist[h->last++], s); if (h->last > HistSize - 1) h->last = 0; } @@ -87,7 +80,7 @@ void mutt_history_add (history_class_t hclass, const char *s) h->cur = h->last; /* reset to the last entry */ } -char *mutt_history_next (history_class_t hclass) +const char *mutt_history_next (history_class_t hclass) { int next; struct history *h = &History[hclass]; @@ -102,7 +95,7 @@ char *mutt_history_next (history_class_t hclass) return (h->hist[h->cur] ? h->hist[h->cur] : ""); } -char *mutt_history_prev (history_class_t hclass) +const char *mutt_history_prev (history_class_t hclass) { int prev; struct history *h = &History[hclass];