From 98ccd0a3050f3dda6c8995e1894b46b8cb7f6ba5 Mon Sep 17 00:00:00 2001 From: pdmef Date: Sun, 24 Jul 2005 11:58:10 +0000 Subject: [PATCH] Rocco Rutte: - add typedef for list_del() to lib/list.h and use it to fix compiler warnings (fix other warnings as well) - fix typo in manual for $xterm_leave git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@339 e385b8ad-14ed-0310-8656-cc95a2468c6d --- buffy.c | 6 +++--- charset.c | 2 +- doc/manual.txt | 6 +++--- init.c | 4 ++-- init.h | 2 +- lib/list.c | 6 +++--- lib/list.h | 9 ++++++--- 7 files changed, 19 insertions(+), 16 deletions(-) diff --git a/buffy.c b/buffy.c index f4718fe..4ede93b 100644 --- a/buffy.c +++ b/buffy.c @@ -168,8 +168,8 @@ void buffy_update_mailbox (BUFFY * b) #endif /* func to free buffy for list_del() */ -static void buffy_free (void** p) { - FREE(&(*((BUFFY**) p))->path); +static void buffy_free (BUFFY** p) { + FREE(&(*p)->path); FREE(p); } @@ -199,7 +199,7 @@ int buffy_parse_mailboxes (BUFFER * path, BUFFER * s, unsigned long data, strfcpy (buf, path->data, sizeof (buf)); if (data == M_UNMAILBOXES && str_eq (buf, "*") == 0) { - list_del (&Incoming, buffy_free); + list_del (&Incoming, (list_del_t*) buffy_free); return 0; } diff --git a/charset.c b/charset.c index fbf8a69..46de91c 100644 --- a/charset.c +++ b/charset.c @@ -564,7 +564,7 @@ char *mutt_get_first_charset (const char *charset) if (!mutt_strlen (c)) return "us-ascii"; if (!(c1 = strchr (c, ':'))) - return charset; + return ((char*) charset); strfcpy (fcharset, c, c1 - c + 1); return fcharset; } diff --git a/doc/manual.txt b/doc/manual.txt index 57c2574..8f11ccd 100644 --- a/doc/manual.txt +++ b/doc/manual.txt @@ -8074,12 +8074,12 @@ there's no easy and portable way to read the current title so mutt-ng cannot read it upon startup and restore it when exiting. - Based on the xterm FAQ, the following might work: set xterm_leave = '`test + Based on the xterm FAQ, the following might work: The Mutt-ng E-Mail Client 148 - x_D_I_S_P_L_A_Y (section , page ) != x && xprop -id _W_I_N_D_O_W_I_D (section , page ) | grep - WM_NAME | cut -d ''' -f 2`' + set xterm_leave = '`test x$DISPLAY != x && xprop -id $WINDOWID | grep WM_NAME | + cut -d ''' -f 2`' _6_._3_._3_3_7 _x_t_e_r_m___s_e_t___t_i_t_l_e_s diff --git a/init.c b/init.c index 6e0d902..7ffb37c 100644 --- a/init.c +++ b/init.c @@ -485,7 +485,7 @@ static int remove_from_rx_list (list2_t** l, const char *str) int i = 0; if (mutt_strcmp ("*", str) == 0) { - list_del (l, rx_free); + list_del (l, (list_del_t*) rx_free); return (0); } else { @@ -698,7 +698,7 @@ static int parse_spam_list (BUFFER * buf, BUFFER * s, unsigned long data, /* "*" is a special case. */ if (!mutt_strcmp (buf->data, "*")) { mutt_free_spam_list (&SpamList); - list_del (&NoSpamList, rx_free); + list_del (&NoSpamList, (list_del_t*) rx_free); return 0; } diff --git a/init.h b/init.h index 1ce0224..5886c78 100644 --- a/init.h +++ b/init.h @@ -3590,7 +3590,7 @@ struct option_t MuttVars[] = { ** Based on the xterm FAQ, the following might work: ** ** .pp - ** \fTset xterm_leave = "`test x$DISPLAY != x && xprop -id $WINDOWID | grep WM_NAME | cut -d '"' -f 2`"\fT + ** \fTset xterm_leave = "`test x$$$DISPLAY != x && xprop -id $$$WINDOWID | grep WM_NAME | cut -d '"' -f 2`"\fP */ {"xterm_title", DT_STR, R_BOTH, UL &XtermTitle, UL "Mutt-ng with %?m?%m messages&no messages?%?n? [%n New]?"}, /* diff --git a/lib/list.c b/lib/list.c index 7d233e7..e921b20 100644 --- a/lib/list.c +++ b/lib/list.c @@ -18,13 +18,13 @@ list2_t* list_new (void) { return (safe_calloc (1, sizeof (list2_t))); } -void list_del (list2_t** l, void (*edel) (void**)) { +void list_del (list2_t** l, list_del_t* del) { size_t i = 0; if (!l || !*l) return; - if (*edel) + if (del) for (i = 0; i < (*l)->length; i++) - edel (&(*l)->data[i]); + del (&(*l)->data[i]); FREE(&(*l)->data); FREE(l); } diff --git a/lib/list.h b/lib/list.h index 9cb4bb3..20f4c60 100644 --- a/lib/list.h +++ b/lib/list.h @@ -28,9 +28,12 @@ typedef struct list2_t { */ list2_t* list_new (void); -/* frees all memory used by list and optionally used edel func - * ptr to free items */ -void list_del (list2_t**, void (*edel) (void**)); + +typedef void list_del_t (void**); + +/* free() all memory used by list and optionally + * use del function to free() items as well */ +void list_del (list2_t**, list_del_t* del); #define list_empty(l) (!l || l->length == 0 || !l->data) -- 2.20.1