X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=enter.c;h=1b97bd439c201c1f9891909d99150c58574cef15;hp=7cd96dce34c15d01280632cfbbff04f2c9ce4d51;hb=49f1156410e9a037404101696d37b2c0d5c67564;hpb=bbc4fd52516a8afefbd14c77e34f8389d6f0a6ed diff --git a/enter.c b/enter.c index 7cd96dc..1b97bd4 100644 --- a/enter.c +++ b/enter.c @@ -12,6 +12,8 @@ # include "config.h" #endif +#include + #include "mutt.h" #include "enter.h" #include "mutt_menu.h" @@ -145,11 +147,11 @@ size_t my_mbstowcs (wchar_t ** pwbuf, size_t * pwbuflen, size_t i, char *buf) * Replace part of the wchar_t buffer, from FROM to CURPOS, by BUF. */ -static void replace_part (ENTER_STATE * state, size_t from, char *buf) +static void replace_part (ENTER_STATE *state, size_t from, const char *buf) { /* Save the suffix */ size_t savelen = state->lastchar - state->curpos; - wchar_t *savebuf = mem_calloc (savelen, sizeof (wchar_t)); + wchar_t *savebuf = p_new(wchar_t, savelen); memcpy (savebuf, state->wbuf + state->curpos, savelen * sizeof (wchar_t)); @@ -166,7 +168,7 @@ static void replace_part (ENTER_STATE * state, size_t from, char *buf) memcpy (state->wbuf + state->curpos, savebuf, savelen * sizeof (wchar_t)); state->lastchar = state->curpos + savelen; - mem_free (&savebuf); + p_delete(&savebuf); } /* @@ -275,13 +277,13 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, switch (ch) { case OP_EDITOR_HISTORY_UP: state->curpos = state->lastchar; - replace_part (state, 0, mutt_history_prev (hclass)); + replace_part(state, 0, mutt_history_prev(hclass)); redraw = M_REDRAW_INIT; break; case OP_EDITOR_HISTORY_DOWN: state->curpos = state->lastchar; - replace_part (state, 0, mutt_history_next (hclass)); + replace_part(state, 0, mutt_history_next(hclass)); redraw = M_REDRAW_INIT; break; @@ -636,7 +638,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, char **tfiles; *numfiles = 1; - tfiles = mem_calloc (*numfiles, sizeof (char *)); + tfiles = p_new(char *, *numfiles); mutt_expand_path (buf, buflen); tfiles[0] = str_dup (buf); *files = tfiles; @@ -663,7 +665,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, bye: - mem_free (&tempbuf); + p_delete(&tempbuf); return rv; } @@ -672,8 +674,8 @@ void mutt_free_enter_state (ENTER_STATE ** esp) if (!esp) return; - mem_free (&(*esp)->wbuf); - mem_free (esp); + p_delete(&(*esp)->wbuf); + p_delete(esp); } /*