From: Brendan Cully Date: Sun, 9 Aug 2009 21:45:31 +0000 (-0700) Subject: Add buffy_new and buffy_free abstractions. X-Git-Tag: mutt-1-5-21-rel~132 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=61d6c8cd224bea085d4133aee3129a6c0c45bbb8;p=mutt Add buffy_new and buffy_free abstractions. --- diff --git a/ChangeLog b/ChangeLog index fc9ee344..b69467c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,15 +1,20 @@ +2009-08-09 14:53 +0200 Christian Ebert (0153dbc12dc4) + + * doc/manual.xml.head: manual: fix wrong spell checker assumptions + +2009-08-09 14:35 +0200 Rocco Rutte (59b4c73e7254) + + * doc/manual.xml.head: Manual: Fix typos, consequently use + en_US spelling + 2009-08-08 22:50 -0700 Brendan Cully (d4ea7f571f10) * buffy.c: Split out mailbox-specific code in mutt_buffy_check -2009-08-08 20:58 -0700 Brendan Cully (3b30cebbb35e) - * buffy.c, muttlib.c, mx.c, mx.h, status.c: Unconditionally define M_IMAP, M_POP. These aren't bloat, and not having them creates a lot of #ifdef clutter. -2009-08-08 16:40 -0700 Brendan Cully (c837ab790d2e) - * curs_lib.c: Abort prompt on ^C, as was the case prior to 12a6de725483 diff --git a/buffy.c b/buffy.c index f2d02f4a..614bf115 100644 --- a/buffy.c +++ b/buffy.c @@ -193,6 +193,23 @@ void mutt_update_mailbox (BUFFY * b) return; } +static BUFFY *buffy_new (const char *path) +{ + BUFFY* buffy; + + buffy = (BUFFY *) safe_calloc (1, sizeof (BUFFY)); + strfcpy (buffy->path, path, sizeof (buffy->path)); + buffy->next = NULL; + buffy->magic = 0; + + return buffy; +} + +static void buffy_free (BUFFY **mailbox) +{ + FREE (mailbox); /* __FREE_CHECKED__ */ +} + int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *err) { BUFFY **tmp,*tmp1; @@ -211,7 +228,7 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *e for (tmp = &Incoming; *tmp;) { tmp1=(*tmp)->next; - FREE (tmp); /* __FREE_CHECKED__ */ + buffy_free (tmp); *tmp=tmp1; } return 0; @@ -239,21 +256,14 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *e if(*tmp) { tmp1=(*tmp)->next; - FREE (tmp); /* __FREE_CHECKED__ */ + buffy_free (tmp); *tmp=tmp1; } continue; } if (!*tmp) - { - *tmp = (BUFFY *) safe_calloc (1, sizeof (BUFFY)); - strfcpy ((*tmp)->path, buf, sizeof ((*tmp)->path)); - (*tmp)->next = NULL; - /* it is tempting to set magic right here */ - (*tmp)->magic = 0; - - } + *tmp = buffy_new (buf); (*tmp)->new = 0; (*tmp)->notified = 1;