X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=enter.c;h=b7427392b82114c97bcf9501d091b079e777fb37;hb=d4483b5add8d25008c305b51729f4a53bccfaab8;hp=cda61f2a5c454817ba982fa5649b95a98c7cc5fb;hpb=8e037c67a88cb4680c4391134c578e3b55a80f8a;p=apps%2Fmadmutt.git diff --git a/enter.c b/enter.c index cda61f2..b742739 100644 --- a/enter.c +++ b/enter.c @@ -22,7 +22,6 @@ #include "history.h" #include "buffy.h" -#include "lib/mem.h" #include @@ -135,7 +134,7 @@ size_t my_mbstowcs (wchar_t ** pwbuf, size_t * pwbuflen, size_t i, char *buf) k != (size_t) (-1) && k != (size_t) (-2); buf += k) { if (i >= wbuflen) { wbuflen = i + 20; - mem_realloc (&wbuf, wbuflen * sizeof (*wbuf)); + p_realloc(&wbuf, wbuflen); } wbuf[i++] = wc; } @@ -151,7 +150,7 @@ 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)); @@ -161,7 +160,7 @@ static void replace_part (ENTER_STATE *state, size_t from, const char *buf) /* Make space for suffix */ if (state->curpos + savelen > state->wbuflen) { state->wbuflen = state->curpos + savelen; - mem_realloc (&state->wbuf, state->wbuflen * sizeof (wchar_t)); + p_realloc(&state->wbuf, state->wbuflen); } /* Restore suffix */ @@ -471,7 +470,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, } if (!mutt_complete (buf, buflen)) { templen = state->lastchar - i; - mem_realloc (&tempbuf, templen * sizeof (wchar_t)); + p_realloc(&tempbuf, templen); } else BEEP (); @@ -504,7 +503,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, goto bye; } else if (flags & M_COMMAND) { my_wcstombs (buf, buflen, state->wbuf, state->curpos); - i = str_len (buf); + i = m_strlen(buf); if (i && buf[i - 1] == '=' && mutt_var_value_complete (buf, buflen, i)) state->tabs = 0; @@ -539,7 +538,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, if (!mutt_complete (buf, buflen)) { templen = state->lastchar; - mem_realloc (&tempbuf, templen * sizeof (wchar_t)); + p_realloc(&tempbuf, templen); memcpy (tempbuf, state->wbuf, templen * sizeof (wchar_t)); } else @@ -638,9 +637,9 @@ 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); + tfiles[0] = m_strdup(buf); *files = tfiles; } rv = 0; @@ -649,7 +648,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, else if (wc && (wc < ' ' || IsWPrint (wc))) { /* why? */ if (state->lastchar >= state->wbuflen) { state->wbuflen = state->lastchar + 20; - mem_realloc (&state->wbuf, state->wbuflen * sizeof (wchar_t)); + p_realloc(&state->wbuf, state->wbuflen); } memmove (state->wbuf + state->curpos + 1, state->wbuf + state->curpos, (state->lastchar - state->curpos) * sizeof (wchar_t));