X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=pager.c;h=c3800dfe4e92712dadbddcdb811e703f79584bfe;hb=8e037c67a88cb4680c4391134c578e3b55a80f8a;hp=f255590afb2cb8a551c635dda1a578cc0c87fb00;hpb=ef7b80006ebb47372d69c64e8b2b2f0764333d55;p=apps%2Fmadmutt.git diff --git a/pager.c b/pager.c index f255590..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" @@ -43,6 +45,7 @@ #include "lib/rx.h" #include "lib/debug.h" +#include #include #include #include @@ -352,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; } @@ -1157,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; } @@ -1232,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 = @@ -1469,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; } @@ -1552,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 @@ -1735,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; @@ -1755,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; @@ -1931,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; } } @@ -1945,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; @@ -2237,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) { @@ -2626,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);