X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=pager.c;h=c3800dfe4e92712dadbddcdb811e703f79584bfe;hb=8e037c67a88cb4680c4391134c578e3b55a80f8a;hp=d68d0411292422f65c5f5708a4b4f1f8c7814e3b;hpb=c25bc063f35aaad6938c2022dae7a283346c2769;p=apps%2Fmadmutt.git diff --git a/pager.c b/pager.c index d68d041..c3800df 100644 --- a/pager.c +++ b/pager.c @@ -15,6 +15,8 @@ # include "config.h" #endif +#include + #include "mutt.h" #include "enter.h" #include "mutt_curses.h" @@ -353,8 +355,8 @@ static void cleanup_quote (struct q_class_t **QuoteList) cleanup_quote (&((*QuoteList)->down)); ptr = (*QuoteList)->next; if ((*QuoteList)->prefix) - mem_free (&(*QuoteList)->prefix); - mem_free (QuoteList); + p_delete(&(*QuoteList)->prefix); + p_delete(QuoteList); *QuoteList = ptr; } @@ -1158,7 +1160,7 @@ display_line (FILE * f, off_t *last_pos, struct line_t **lineInfo, int n, memset (&((*lineInfo)[ch]), 0, sizeof (struct line_t)); (*lineInfo)[ch].type = -1; (*lineInfo)[ch].search_cnt = -1; - (*lineInfo)[ch].syntax = mem_malloc (sizeof (struct syntax_t)); + (*lineInfo)[ch].syntax = p_new(struct syntax_t, 1); ((*lineInfo)[ch].syntax)[0].first = ((*lineInfo)[ch].syntax)[0].last = -1; } @@ -1233,7 +1235,7 @@ display_line (FILE * f, off_t *last_pos, struct line_t **lineInfo, int n, mem_realloc (&((*lineInfo)[n].search), ((*lineInfo)[n].search_cnt) * sizeof (struct syntax_t)); else - (*lineInfo)[n].search = mem_malloc (sizeof (struct syntax_t)); + (*lineInfo)[n].search = p_new(struct syntax_t, 1); pmatch[0].rm_so += offset; pmatch[0].rm_eo += offset; ((*lineInfo)[n].search)[(*lineInfo)[n].search_cnt - 1].first = @@ -1470,12 +1472,12 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) mutt_set_flag (Context, extra->hdr, M_READ, 1); } - lineInfo = mem_malloc (sizeof (struct line_t) * (maxLine = LINES)); + lineInfo = p_new(struct line_t, maxLine = LINES); for (i = 0; i < maxLine; i++) { memset (&lineInfo[i], 0, sizeof (struct line_t)); lineInfo[i].type = -1; lineInfo[i].search_cnt = -1; - lineInfo[i].syntax = mem_malloc (sizeof (struct syntax_t)); + lineInfo[i].syntax = p_new(struct syntax_t, 1); (lineInfo[i].syntax)[0].first = (lineInfo[i].syntax)[0].last = -1; } @@ -1553,7 +1555,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) lines = Resize->line; redraw |= REDRAW_SIGWINCH; - mem_free (&Resize); + p_delete(&Resize); } #endif @@ -1736,7 +1738,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) lines++; if (flags & M_PAGER_RETWINCH) { - Resize = mem_malloc (sizeof (struct resize)); + Resize = p_new(struct resize, 1); Resize->line = lines; Resize->SearchCompiled = SearchCompiled; @@ -1756,7 +1758,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) mem_realloc (&(lineInfo[i].syntax), sizeof (struct syntax_t)); if (SearchCompiled && lineInfo[i].search) - mem_free (&(lineInfo[i].search)); + p_delete(&(lineInfo[i].search)); } lastLine = 0; @@ -1932,7 +1934,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) regfree (&SearchRE); for (i = 0; i < lastLine; i++) { if (lineInfo[i].search) - mem_free (&(lineInfo[i].search)); + p_delete(&(lineInfo[i].search)); lineInfo[i].search_cnt = -1; } } @@ -1946,7 +1948,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) for (i = 0; i < maxLine; i++) { /* cleanup */ if (lineInfo[i].search) - mem_free (&(lineInfo[i].search)); + p_delete(&(lineInfo[i].search)); lineInfo[i].search_cnt = -1; } SearchFlag = 0; @@ -2238,7 +2240,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) mem_realloc (&(lineInfo[i].syntax), sizeof (struct syntax_t)); if (SearchCompiled && lineInfo[i].search) - mem_free (&(lineInfo[i].search)); + p_delete(&(lineInfo[i].search)); } if (SearchCompiled) { @@ -2627,15 +2629,15 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) cleanup_quote (&QuoteList); for (i = 0; i < maxLine; i++) { - mem_free (&(lineInfo[i].syntax)); + p_delete(&(lineInfo[i].syntax)); if (SearchCompiled && lineInfo[i].search) - mem_free (&(lineInfo[i].search)); + p_delete(&(lineInfo[i].search)); } if (SearchCompiled) { regfree (&SearchRE); SearchCompiled = 0; } - mem_free (&lineInfo); + p_delete(&lineInfo); if (index) mutt_menuDestroy (&index); return (rc != -1 ? rc : 0);