aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buffer.c80
-rw-r--r--src/diff.c40
-rw-r--r--src/digraph.c16
-rw-r--r--src/edit.c70
-rw-r--r--src/eval.c298
-rw-r--r--src/ex_cmds.c136
-rw-r--r--src/ex_cmds2.c74
-rw-r--r--src/ex_docmd.c134
-rw-r--r--src/ex_eval.c26
-rw-r--r--src/ex_getln.c106
-rw-r--r--src/file_search.c54
-rw-r--r--src/fileio.c144
-rw-r--r--src/fold.c4
-rw-r--r--src/garray.c6
-rw-r--r--src/getchar.c66
-rw-r--r--src/hardcopy.c20
-rw-r--r--src/hashtab.c6
-rw-r--r--src/if_cscope.c98
-rw-r--r--src/indent.c2
-rw-r--r--src/indent_c.c4
-rw-r--r--src/main.c10
-rw-r--r--src/mark.c40
-rw-r--r--src/mbyte.c20
-rw-r--r--src/memfile.c48
-rw-r--r--src/memline.c72
-rw-r--r--src/memory.c6
-rw-r--r--src/menu.c64
-rw-r--r--src/message.c36
-rw-r--r--src/misc1.c44
-rw-r--r--src/misc2.c8
-rw-r--r--src/normal.c18
-rw-r--r--src/ops.c78
-rw-r--r--src/option.c52
-rw-r--r--src/os/fs.c4
-rw-r--r--src/os_unix.c24
-rw-r--r--src/path.c56
-rw-r--r--src/popupmnu.c6
-rw-r--r--src/quickfix.c86
-rw-r--r--src/regexp.c28
-rw-r--r--src/regexp_nfa.c20
-rw-r--r--src/screen.c52
-rw-r--r--src/search.c54
-rw-r--r--src/spell.c170
-rw-r--r--src/strings.c2
-rw-r--r--src/syntax.c166
-rw-r--r--src/tag.c60
-rw-r--r--src/term.c16
-rw-r--r--src/ui.c8
-rw-r--r--src/undo.c42
-rw-r--r--src/window.c34
50 files changed, 1358 insertions, 1350 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 35d5582340..4e87305c60 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -430,8 +430,8 @@ aucmd_abort:
* Remove the buffer from the list.
*/
if (wipe_buf) {
- vim_free(buf->b_ffname);
- vim_free(buf->b_sfname);
+ free(buf->b_ffname);
+ free(buf->b_sfname);
if (buf->b_prev == NULL)
firstbuf = buf->b_next;
else
@@ -552,7 +552,7 @@ static void free_buffer(buf_T *buf)
buf->b_next = au_pending_free_buf;
au_pending_free_buf = buf;
} else {
- vim_free(buf);
+ free(buf);
}
}
@@ -576,7 +576,7 @@ free_buffer_stuff (
buf_delete_signs(buf); /* delete any signs */
map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); /* clear local mappings */
map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */
- vim_free(buf->b_start_fenc);
+ free(buf->b_start_fenc);
buf->b_start_fenc = NULL;
}
@@ -594,7 +594,7 @@ static void clear_wininfo(buf_T *buf)
clear_winopt(&wip->wi_opt);
deleteFoldRecurse(&wip->wi_folds);
}
- vim_free(wip);
+ free(wip);
}
}
@@ -1327,7 +1327,7 @@ buflist_new (
buflist_findname(ffname)
#endif
) != NULL) {
- vim_free(ffname);
+ free(ffname);
if (lnum != 0)
buflist_setfpos(buf, curwin, lnum, (colnr_T)0, FALSE);
/* copy the options now, if 'cpo' doesn't have 's' and not done
@@ -1390,9 +1390,9 @@ buflist_new (
buf->b_wininfo = xcalloc(1, sizeof(wininfo_T));
if (ffname != NULL && (buf->b_ffname == NULL || buf->b_sfname == NULL)) {
- vim_free(buf->b_ffname);
+ free(buf->b_ffname);
buf->b_ffname = NULL;
- vim_free(buf->b_sfname);
+ free(buf->b_sfname);
buf->b_sfname = NULL;
if (buf != curbuf)
free_buffer(buf);
@@ -1669,7 +1669,7 @@ buf_T *buflist_findname_exp(char_u *fname)
);
if (ffname != NULL) {
buf = buflist_findname(ffname);
- vim_free(ffname);
+ free(ffname);
}
return buf;
}
@@ -1771,7 +1771,7 @@ buflist_findpat (
++p;
prog = vim_regcomp(p, p_magic ? RE_MAGIC : 0);
if (prog == NULL) {
- vim_free(pat);
+ free(pat);
return -1;
}
@@ -1809,7 +1809,7 @@ buflist_findpat (
find_listed = FALSE;
}
- vim_free(pat);
+ free(pat);
}
if (match == -2)
@@ -1856,7 +1856,7 @@ int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options)
prog = vim_regcomp(patc + attempt * 11, RE_MAGIC);
if (prog == NULL) {
if (patc != pat)
- vim_free(patc);
+ free(patc);
return FAIL;
}
@@ -1894,7 +1894,7 @@ int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options)
}
if (patc != pat)
- vim_free(patc);
+ free(patc);
*num_file = count;
return count == 0 ? FAIL : OK;
@@ -1937,7 +1937,7 @@ static char_u *fname_match(regprog_T *prog, char_u *name)
p = home_replace_save(NULL, name);
if (p != NULL && vim_regexec(&regmatch, p, (colnr_T)0))
match = name;
- vim_free(p);
+ free(p);
}
}
@@ -2226,8 +2226,8 @@ setfname (
if (ffname == NULL || *ffname == NUL) {
/* Removing the name. */
- vim_free(buf->b_ffname);
- vim_free(buf->b_sfname);
+ free(buf->b_ffname);
+ free(buf->b_sfname);
buf->b_ffname = NULL;
buf->b_sfname = NULL;
#ifdef UNIX
@@ -2257,7 +2257,7 @@ setfname (
if (obuf->b_ml.ml_mfp != NULL) { /* it's loaded, fail */
if (message)
EMSG(_("E95: Buffer with this name already exists"));
- vim_free(ffname);
+ free(ffname);
return FAIL;
}
/* delete from the list */
@@ -2265,15 +2265,15 @@ setfname (
}
sfname = vim_strsave(sfname);
if (ffname == NULL || sfname == NULL) {
- vim_free(sfname);
- vim_free(ffname);
+ free(sfname);
+ free(ffname);
return FAIL;
}
#ifdef USE_FNAME_CASE
fname_case(sfname, 0); /* set correct case for short file name */
#endif
- vim_free(buf->b_ffname);
- vim_free(buf->b_sfname);
+ free(buf->b_ffname);
+ free(buf->b_sfname);
buf->b_ffname = ffname;
buf->b_sfname = sfname;
}
@@ -2302,8 +2302,8 @@ void buf_set_name(int fnum, char_u *name)
buf = buflist_findnr(fnum);
if (buf != NULL) {
- vim_free(buf->b_sfname);
- vim_free(buf->b_ffname);
+ free(buf->b_sfname);
+ free(buf->b_ffname);
buf->b_ffname = vim_strsave(name);
buf->b_sfname = NULL;
/* Allocate ffname and expand into full path. Also resolves .lnk
@@ -2595,7 +2595,7 @@ fileinfo (
set_keep_msg(p, 0);
}
- vim_free(buffer);
+ free(buffer);
}
void col_print(char_u *buf, size_t buflen, int col, int vcol)
@@ -2670,7 +2670,7 @@ void maketitle(void)
else {
p = transstr(path_tail(curbuf->b_fname));
vim_strncpy(buf, p, SPACE_FOR_FNAME);
- vim_free(p);
+ free(p);
}
switch (bufIsChanged(curbuf)
@@ -2712,7 +2712,7 @@ void maketitle(void)
if (off < SPACE_FOR_DIR) {
p = transstr(buf + off);
vim_strncpy(buf + off, p, (size_t)(SPACE_FOR_DIR - off));
- vim_free(p);
+ free(p);
} else {
vim_strncpy(buf + off, (char_u *)"...",
(size_t)(SPACE_FOR_ARGNR - off));
@@ -2785,7 +2785,7 @@ static int ti_change(char_u *str, char_u **last)
{
if ((str == NULL) != (*last == NULL)
|| (str != NULL && *last != NULL && STRCMP(str, *last) != 0)) {
- vim_free(*last);
+ free(*last);
if (str == NULL)
*last = NULL;
else
@@ -2806,8 +2806,8 @@ void resettitle(void)
# if defined(EXITFREE) || defined(PROTO)
void free_titles(void)
{
- vim_free(lasttitle);
- vim_free(lasticon);
+ free(lasttitle);
+ free(lasticon);
}
# endif
@@ -3159,7 +3159,7 @@ build_stl_str_hl (
if (str != NULL && *str != 0) {
if (*skipdigits(str) == NUL) {
num = atoi((char *)str);
- vim_free(str);
+ free(str);
str = NULL;
itemisflag = FALSE;
}
@@ -3416,7 +3416,7 @@ build_stl_str_hl (
item[curitem].type = Empty;
if (opt == STL_VIM_EXPR)
- vim_free(str);
+ free(str);
if (num >= 0 || (!itemisflag && str && *str))
prevchar_isflag = FALSE; /* Item not NULL, but not a flag */
@@ -3426,7 +3426,7 @@ build_stl_str_hl (
itemcnt = curitem;
if (usefmt != fmt)
- vim_free(usefmt);
+ free(usefmt);
width = vim_strsize(out);
if (maxwidth > 0 && width > maxwidth) {
@@ -3624,7 +3624,7 @@ void fname_expand(buf_T *buf, char_u **ffname, char_u **sfname)
/* If the file name is a shortcut file, use the file it links to. */
rfname = mch_resolve_shortcut(*ffname);
if (rfname != NULL) {
- vim_free(*ffname);
+ free(*ffname);
*ffname = rfname;
*sfname = rfname;
}
@@ -3882,7 +3882,7 @@ do_arg_all (
win_enter(new_curwin, FALSE);
--autocmd_no_leave;
- vim_free(opened);
+ free(opened);
}
/*
@@ -4207,7 +4207,7 @@ chk_modeline (
sourcing_lnum = save_sourcing_lnum;
sourcing_name = save_sourcing_name;
- vim_free(linecopy);
+ free(linecopy);
}
return retval;
}
@@ -4254,7 +4254,7 @@ int read_viminfo_bufferlist(vir_T *virp, int writing)
buflist_setfpos(buf, curwin, lnum, col, FALSE);
}
}
- vim_free(xline);
+ free(xline);
return viminfo_readline(virp);
}
@@ -4297,7 +4297,7 @@ void write_viminfo_bufferlist(FILE *fp)
buf->b_last_cursor.col);
viminfo_writestring(fp, line);
}
- vim_free(line);
+ free(line);
}
@@ -4472,7 +4472,7 @@ linenr_T buf_delsign(
if (sign->id == id) {
*lastp = next;
lnum = sign->lnum;
- vim_free(sign);
+ free(sign);
break;
} else {
lastp = &sign->next;
@@ -4537,7 +4537,7 @@ void buf_delete_signs(buf_T *buf)
while (buf->b_signlist != NULL) {
next = buf->b_signlist->next;
- vim_free(buf->b_signlist);
+ free(buf->b_signlist);
buf->b_signlist = next;
}
}
@@ -4664,7 +4664,7 @@ int buf_contents_changed(buf_T *buf)
}
}
}
- vim_free(ea.cmd);
+ free(ea.cmd);
/* restore curwin/curbuf and a few other things */
aucmd_restbuf(&aco);
diff --git a/src/diff.c b/src/diff.c
index 880ae9edef..a93f1324fe 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -405,7 +405,7 @@ static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1,
}
}
dprev->df_next = dp->df_next;
- vim_free(dp);
+ free(dp);
dp = dprev->df_next;
} else {
// Advance to next entry.
@@ -428,7 +428,7 @@ static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1,
if (i == DB_COUNT) {
diff_T *dnext = dp->df_next;
- vim_free(dp);
+ free(dp);
dp = dnext;
if (dprev == NULL) {
@@ -543,7 +543,7 @@ static void diff_check_unchanged(tabpage_T *tp, diff_T *dp)
break;
}
}
- vim_free(line_org);
+ free(line_org);
// Stop when a line isn't equal in all diff buffers.
if (i_new != DB_COUNT) {
@@ -801,9 +801,9 @@ void ex_diffupdate(exarg_T *eap)
diff_redraw(TRUE);
theend:
- vim_free(tmp_orig);
- vim_free(tmp_new);
- vim_free(tmp_diff);
+ free(tmp_orig);
+ free(tmp_new);
+ free(tmp_diff);
}
/// Make a diff between files "tmp_orig" and "tmp_new", results in "tmp_diff".
@@ -843,7 +843,7 @@ static void diff_file(char_u *tmp_orig, char_u *tmp_new, char_u *tmp_diff)
NULL
);
unblock_autocmds();
- vim_free(cmd);
+ free(cmd);
}
}
@@ -1010,16 +1010,16 @@ theend:
if (tmp_orig != NULL) {
os_remove((char *)tmp_orig);
}
- vim_free(tmp_orig);
+ free(tmp_orig);
if (tmp_new != NULL) {
os_remove((char *)tmp_new);
}
- vim_free(tmp_new);
- vim_free(newname);
- vim_free(buf);
+ free(tmp_new);
+ free(newname);
+ free(buf);
#ifdef UNIX
- vim_free(fullname);
+ free(fullname);
#endif // ifdef UNIX
}
@@ -1362,7 +1362,7 @@ static void diff_read(int idx_orig, int idx_new, char_u *fname)
while (dn != dp->df_next) {
dpl = dn->df_next;
- vim_free(dn);
+ free(dn);
dn = dpl;
}
} else {
@@ -1429,7 +1429,7 @@ void diff_clear(tabpage_T *tp)
diff_T *next_p;
for (p = tp->tp_first_diff; p != NULL; p = next_p) {
next_p = p->df_next;
- vim_free(p);
+ free(p);
}
tp->tp_first_diff = NULL;
}
@@ -1584,7 +1584,7 @@ static int diff_equal_entry(diff_T *dp, int idx1, int idx2)
}
int cmp = diff_cmp(line, ml_get_buf(curtab->tp_diffbuf[idx2],
dp->df_lnum[idx2] + i, FALSE));
- vim_free(line);
+ free(line);
if (cmp != 0) {
return FALSE;
@@ -1892,7 +1892,7 @@ int diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp)
int idx = diff_buf_idx(wp->w_buffer);
if (idx == DB_COUNT) {
// cannot happen
- vim_free(line_org);
+ free(line_org);
return FALSE;
}
@@ -1905,7 +1905,7 @@ int diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp)
}
if ((dp == NULL) || (diff_check_sanity(curtab, dp) == FAIL)) {
- vim_free(line_org);
+ free(line_org);
return FALSE;
}
@@ -1985,7 +1985,7 @@ int diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp)
}
}
- vim_free(line_org);
+ free(line_org);
return added;
}
@@ -2284,7 +2284,7 @@ void ex_diffgetput(exarg_T *eap)
p = vim_strsave(ml_get_buf(curtab->tp_diffbuf[idx_from], nr, FALSE));
if (p != NULL) {
ml_append(lnum + i - 1, p, 0, FALSE);
- vim_free(p);
+ free(p);
added++;
if (buf_empty && (curbuf->b_ml.ml_line_count == 2)) {
// Added the first line into an empty buffer, need to
@@ -2340,7 +2340,7 @@ void ex_diffgetput(exarg_T *eap)
if (dfree != NULL) {
// Diff is deleted, update folds in other windows.
diff_fold_update(dfree, idx_to);
- vim_free(dfree);
+ free(dfree);
} else {
// mark_adjust() may have changed the count in a wrong way
dp->df_count[idx_to] = new_count;
diff --git a/src/digraph.c b/src/digraph.c
index 88f183be4f..7ab8bd181d 100644
--- a/src/digraph.c
+++ b/src/digraph.c
@@ -1527,7 +1527,7 @@ static int getexactdigraph(int char1, int char2, int meta_char)
if (to != NULL) {
retval = (*mb_ptr2char)(to);
- vim_free(to);
+ free(to);
}
(void)convert_setup(&vc, NULL, NULL);
}
@@ -1759,11 +1759,11 @@ char_u* keymap_init(void)
curbuf->b_p_keymap);
if (source_runtime(buf, FALSE) == FAIL) {
- vim_free(buf);
+ free(buf);
return (char_u *)N_("E544: Keymap file not found");
}
}
- vim_free(buf);
+ free(buf);
}
return NULL;
@@ -1825,13 +1825,13 @@ void ex_loadkeymap(exarg_T *eap)
if ((kp->to != NULL) && (*kp->to == NUL)) {
EMSG(_("E791: Empty keymap entry"));
}
- vim_free(kp->from);
- vim_free(kp->to);
+ free(kp->from);
+ free(kp->to);
} else {
++curbuf->b_kmap_ga.ga_len;
}
}
- vim_free(line);
+ free(line);
}
// setup ":lnoremap" to map the keys
@@ -1869,8 +1869,8 @@ static void keymap_unload(void)
for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i) {
vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s", kp[i].from);
(void)do_map(1, buf, LANGMAP, FALSE);
- vim_free(kp[i].from);
- vim_free(kp[i].to);
+ free(kp[i].from);
+ free(kp[i].to);
}
p_cpo = save_cpo;
diff --git a/src/edit.c b/src/edit.c
index d02dd6fbbc..4b1d1878d1 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -569,7 +569,7 @@ edit (
new_insert_skip = 0;
else {
new_insert_skip = (int)STRLEN(ptr);
- vim_free(ptr);
+ free(ptr);
}
old_indent = 0;
@@ -734,7 +734,7 @@ edit (
if (str != NULL) {
for (p = str; *p != NUL; mb_ptr_adv(p))
ins_compl_addleader(PTR2CHAR(p));
- vim_free(str);
+ free(str);
} else
ins_compl_addleader(c);
continue;
@@ -1239,7 +1239,7 @@ normalchar:
}
AppendToRedobuffLit(str, -1);
}
- vim_free(str);
+ free(str);
c = NUL;
}
@@ -1656,7 +1656,7 @@ change_indent (
memset(ptr, ' ', i);
new_cursor_col += i;
ins_str(ptr);
- vim_free(ptr);
+ free(ptr);
}
/*
@@ -1742,7 +1742,7 @@ change_indent (
/* Insert new stuff into line again */
ins_bytes(new_line);
- vim_free(new_line);
+ free(new_line);
}
}
@@ -2067,7 +2067,7 @@ int ins_compl_add_infercase(char_u *str, int len, int icase, char_u *fname, int
*(p++) = wca[i++];
*p = NUL;
- vim_free(wca);
+ free(wca);
return ins_compl_add(IObuff, len, icase, fname, NULL, dir,
flags, FALSE);
@@ -2128,7 +2128,7 @@ ins_compl_add (
if (flags & ORIGINAL_TEXT)
match->cp_number = 0;
if ((match->cp_str = vim_strnsave(str, len)) == NULL) {
- vim_free(match);
+ free(match);
return FAIL;
}
match->cp_icase = icase;
@@ -2373,7 +2373,7 @@ static void ins_compl_del_pum(void)
{
if (compl_match_array != NULL) {
pum_undisplay();
- vim_free(compl_match_array);
+ free(compl_match_array);
compl_match_array = NULL;
}
}
@@ -2594,8 +2594,8 @@ ins_compl_dictionaries (
ptr = xmalloc(len);
vim_snprintf((char *)ptr, len, "^\\s*\\zs\\V%s", pat_esc);
regmatch.regprog = vim_regcomp(ptr, RE_MAGIC);
- vim_free(pat_esc);
- vim_free(ptr);
+ free(pat_esc);
+ free(ptr);
} else {
regmatch.regprog = vim_regcomp(pat, p_magic ? RE_MAGIC : 0);
if (regmatch.regprog == NULL)
@@ -2643,7 +2643,7 @@ ins_compl_dictionaries (
theend:
p_scs = save_p_scs;
vim_regfree(regmatch.regprog);
- vim_free(buf);
+ free(buf);
}
static void ins_compl_files(int count, char_u **files, int thesaurus, int flags, regmatch_T *regmatch, char_u *buf, int *dir)
@@ -2792,9 +2792,9 @@ static void ins_compl_free(void)
compl_T *match;
int i;
- vim_free(compl_pattern);
+ free(compl_pattern);
compl_pattern = NULL;
- vim_free(compl_leader);
+ free(compl_leader);
compl_leader = NULL;
if (compl_first_match == NULL)
@@ -2807,13 +2807,13 @@ static void ins_compl_free(void)
do {
match = compl_curr_match;
compl_curr_match = compl_curr_match->cp_next;
- vim_free(match->cp_str);
+ free(match->cp_str);
/* several entries may use the same fname, free it just once. */
if (match->cp_flags & FREE_FNAME)
- vim_free(match->cp_fname);
+ free(match->cp_fname);
for (i = 0; i < CPT_COUNT; ++i)
- vim_free(match->cp_text[i]);
- vim_free(match);
+ free(match->cp_text[i]);
+ free(match);
} while (compl_curr_match != NULL && compl_curr_match != compl_first_match);
compl_first_match = compl_curr_match = NULL;
compl_shown_match = NULL;
@@ -2824,12 +2824,12 @@ static void ins_compl_clear(void)
compl_cont_status = 0;
compl_started = FALSE;
compl_matches = 0;
- vim_free(compl_pattern);
+ free(compl_pattern);
compl_pattern = NULL;
- vim_free(compl_leader);
+ free(compl_leader);
compl_leader = NULL;
edit_submode_extra = NULL;
- vim_free(compl_orig_text);
+ free(compl_orig_text);
compl_orig_text = NULL;
compl_enter_selects = FALSE;
}
@@ -2870,7 +2870,7 @@ static int ins_compl_bs(void)
|| ins_compl_need_restart())
ins_compl_restart();
- vim_free(compl_leader);
+ free(compl_leader);
compl_leader = vim_strnsave(line + compl_col, (int)(p - line) - compl_col);
if (compl_leader != NULL) {
ins_compl_new_leader();
@@ -2976,7 +2976,7 @@ static void ins_compl_addleader(int c)
* cursor doesn't point original position, changing compl_leader would
* break redo. */
if (!compl_opt_refresh_always) {
- vim_free(compl_leader);
+ free(compl_leader);
compl_leader = vim_strnsave(ml_get_curline() + compl_col,
(int)(curwin->w_cursor.col - compl_col));
if (compl_leader != NULL)
@@ -3008,7 +3008,7 @@ static void ins_compl_set_original_text(char_u *str)
if (compl_first_match->cp_flags & ORIGINAL_TEXT) { /* safety check */
p = vim_strsave(str);
if (p != NULL) {
- vim_free(compl_first_match->cp_str);
+ free(compl_first_match->cp_str);
compl_first_match->cp_str = p;
}
}
@@ -4565,13 +4565,13 @@ static int ins_complete(int c)
ins_compl_fixRedoBufForLeader(NULL);
/* Always add completion for the original text. */
- vim_free(compl_orig_text);
+ free(compl_orig_text);
compl_orig_text = vim_strnsave(line + compl_col, compl_length);
if (compl_orig_text == NULL || ins_compl_add(compl_orig_text,
-1, p_ic, NULL, NULL, 0, ORIGINAL_TEXT, FALSE) != OK) {
- vim_free(compl_pattern);
+ free(compl_pattern);
compl_pattern = NULL;
- vim_free(compl_orig_text);
+ free(compl_orig_text);
compl_orig_text = NULL;
return FAIL;
}
@@ -5441,7 +5441,7 @@ internal_format (
* moved, now we re-insert it into the new line.
*/
ins_bytes(saved_text);
- vim_free(saved_text);
+ free(saved_text);
} else {
/*
* Check if cursor is not past the NUL off the line, cindent
@@ -5768,11 +5768,11 @@ stop_insert (
ptr = get_inserted();
if (did_restart_edit == 0 || (ptr != NULL
&& (int)STRLEN(ptr) > new_insert_skip)) {
- vim_free(last_insert);
+ free(last_insert);
last_insert = ptr;
last_insert_skip = new_insert_skip;
} else
- vim_free(ptr);
+ free(ptr);
if (!arrow_used && end_insert_pos != NULL) {
/* Auto-format now. It may seem strange to do this when stopping an
@@ -5871,7 +5871,7 @@ void set_last_insert(int c)
{
char_u *s;
- vim_free(last_insert);
+ free(last_insert);
last_insert = xmalloc(MB_MAXBYTES * 3 + 5);
s = last_insert;
/* Use the CTRL-V only when entering a special char */
@@ -5886,9 +5886,9 @@ void set_last_insert(int c)
#if defined(EXITFREE) || defined(PROTO)
void free_last_insert(void)
{
- vim_free(last_insert);
+ free(last_insert);
last_insert = NULL;
- vim_free(compl_orig_text);
+ free(compl_orig_text);
compl_orig_text = NULL;
}
@@ -6289,7 +6289,7 @@ replace_push (
if (replace_stack != NULL) {
memmove(p, replace_stack,
(size_t)(replace_stack_nr * sizeof(char_u)));
- vim_free(replace_stack);
+ free(replace_stack);
}
replace_stack = p;
}
@@ -6415,7 +6415,7 @@ static void mb_replace_pop_ins(int cc)
*/
static void replace_flush(void)
{
- vim_free(replace_stack);
+ free(replace_stack);
replace_stack = NULL;
replace_stack_len = 0;
replace_stack_nr = 0;
@@ -8103,7 +8103,7 @@ static int ins_tab(void)
}
if (State & VREPLACE_FLAG)
- vim_free(saved_line);
+ free(saved_line);
curwin->w_p_list = save_list;
}
diff --git a/src/eval.c b/src/eval.c
index df11174898..61a33c04d9 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -911,7 +911,7 @@ void eval_clear(void)
for (i = 0; i < VV_LEN; ++i) {
p = &vimvars[i];
if (p->vv_di.di_tv.v_type == VAR_STRING) {
- vim_free(p->vv_str);
+ free(p->vv_str);
p->vv_str = NULL;
} else if (p->vv_di.di_tv.v_type == VAR_LIST) {
list_unref(p->vv_list);
@@ -937,7 +937,7 @@ void eval_clear(void)
for (i = 1; i <= ga_scripts.ga_len; ++i)
vars_clear(&SCRIPT_VARS(i));
for (i = 1; i <= ga_scripts.ga_len; ++i)
- vim_free(SCRIPT_SV(i));
+ free(SCRIPT_SV(i));
ga_clear(&ga_scripts);
/* unreferenced lists and dicts */
@@ -1135,13 +1135,13 @@ void var_redir_stop(void)
}
/* free the collected output */
- vim_free(redir_ga.ga_data);
+ free(redir_ga.ga_data);
redir_ga.ga_data = NULL;
- vim_free(redir_lval);
+ free(redir_lval);
redir_lval = NULL;
}
- vim_free(redir_varname);
+ free(redir_varname);
redir_varname = NULL;
}
@@ -1460,7 +1460,7 @@ typval_T *eval_expr(char_u *arg, char_u **nextcmd)
tv = (typval_T *)alloc(sizeof(typval_T));
if (tv != NULL && eval0(arg, tv, nextcmd, TRUE) == FAIL) {
- vim_free(tv);
+ free(tv);
tv = NULL;
}
@@ -1531,7 +1531,7 @@ call_vim_function (
--sandbox;
restore_funccal(save_funccalp);
}
- vim_free(argvars);
+ free(argvars);
if (ret == FAIL)
clear_tv(rettv);
@@ -2097,14 +2097,14 @@ static char_u *list_arg_vars(exarg_T *eap, char_u *arg, int *first)
s == NULL ? (char_u *)"" : s,
first);
*arg = c;
- vim_free(tf);
+ free(tf);
}
clear_tv(&tv);
}
}
}
- vim_free(tofree);
+ free(tofree);
}
arg = skipwhite(arg);
@@ -2162,7 +2162,7 @@ ex_let_one (
if (s != NULL) {
p = tofree = concat_str(s, p);
if (mustfree)
- vim_free(s);
+ free(s);
}
}
if (p != NULL) {
@@ -2177,7 +2177,7 @@ ex_let_one (
arg_end = arg;
}
name[len] = c1;
- vim_free(tofree);
+ free(tofree);
}
}
}
@@ -2218,7 +2218,7 @@ ex_let_one (
n = numval - n;
} else if (opt_type == 0 && stringval != NULL) { /* string */
s = concat_str(stringval, s);
- vim_free(stringval);
+ free(stringval);
stringval = s;
}
}
@@ -2228,7 +2228,7 @@ ex_let_one (
arg_end = p;
}
*p = c1;
- vim_free(stringval);
+ free(stringval);
}
}
/*
@@ -2250,14 +2250,14 @@ ex_let_one (
s = get_reg_contents(*arg == '@' ? '"' : *arg, TRUE, TRUE);
if (s != NULL) {
p = ptofree = concat_str(s, p);
- vim_free(s);
+ free(s);
}
}
if (p != NULL) {
write_reg_contents(*arg == '@' ? '"' : *arg, p, -1, FALSE);
arg_end = arg + 1;
}
- vim_free(ptofree);
+ free(ptofree);
}
}
/*
@@ -2619,8 +2619,8 @@ get_lval (
*/
static void clear_lval(lval_T *lp)
{
- vim_free(lp->ll_exp_name);
- vim_free(lp->ll_newkey);
+ free(lp->ll_exp_name);
+ free(lp->ll_newkey);
}
/*
@@ -2698,7 +2698,7 @@ static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, int copy, ch
if (di == NULL)
return;
if (dict_add(lp->ll_tv->vval.v_dict, di) == FAIL) {
- vim_free(di);
+ free(di);
return;
}
lp->ll_tv = &di->di_tv;
@@ -2933,7 +2933,7 @@ void free_for_info(void *fi_void)
list_rem_watch(fi->fi_list, &fi->fi_lw);
list_unref(fi->fi_list);
}
- vim_free(fi);
+ free(fi);
}
@@ -3047,7 +3047,7 @@ void ex_call(exarg_T *eap)
if (fudi.fd_newkey != NULL) {
/* Still need to give an error message for missing key. */
EMSG2(_(e_dictkey), fudi.fd_newkey);
- vim_free(fudi.fd_newkey);
+ free(fudi.fd_newkey);
}
if (tofree == NULL)
return;
@@ -3127,7 +3127,7 @@ void ex_call(exarg_T *eap)
end:
dict_unref(fudi.fd_dict);
- vim_free(tofree);
+ free(tofree);
}
/*
@@ -3439,7 +3439,7 @@ static char_u *cat_prefix_varname(int prefix, char_u *name)
len = (int)STRLEN(name) + 3;
if (len > varnamebuflen) {
- vim_free(varnamebuf);
+ free(varnamebuf);
len += 10; /* some additional space */
varnamebuf = alloc(len);
if (varnamebuf == NULL) {
@@ -3530,7 +3530,7 @@ char_u *get_user_var_name(expand_T *xp, int idx)
if (vidx < VV_LEN)
return cat_prefix_varname('v', (char_u *)vimvars[vidx++].vv_name);
- vim_free(varnamebuf);
+ free(varnamebuf);
varnamebuf = NULL;
varnamebuflen = 0;
return NULL;
@@ -4537,7 +4537,7 @@ eval7 (
else
ret = OK;
}
- vim_free(alias);
+ free(alias);
}
*arg = skipwhite(*arg);
@@ -5181,9 +5181,9 @@ list_free (
if (recurse || (item->li_tv.v_type != VAR_LIST
&& item->li_tv.v_type != VAR_DICT))
clear_tv(&item->li_tv);
- vim_free(item);
+ free(item);
}
- vim_free(l);
+ free(l);
}
/*
@@ -5200,7 +5200,7 @@ listitem_T *listitem_alloc(void)
void listitem_free(listitem_T *item)
{
clear_tv(&item->li_tv);
- vim_free(item);
+ free(item);
}
/*
@@ -5669,7 +5669,7 @@ static list_T *list_copy(list_T *orig, int deep, int copyID)
break;
if (deep) {
if (item_copy(&item->li_tv, &ni->li_tv, deep, copyID) == FAIL) {
- vim_free(ni);
+ free(ni);
break;
}
} else
@@ -5726,7 +5726,7 @@ static char_u *list2string(typval_T *tv, int copyID)
ga_init(&ga, (int)sizeof(char), 80);
ga_append(&ga, '[');
if (list_join(&ga, tv->vval.v_list, (char_u *)", ", FALSE, copyID) == FAIL) {
- vim_free(ga.ga_data);
+ free(ga.ga_data);
return NULL;
}
ga_append(&ga, ']');
@@ -5824,7 +5824,7 @@ static int list_join(garray_T *gap, list_T *l, char_u *sep, int echo_style, int
if (join_ga.ga_data != NULL) {
p = (join_T *)join_ga.ga_data;
for (i = 0; i < join_ga.ga_len; ++i) {
- vim_free(p->tofree);
+ free(p->tofree);
++p;
}
ga_clear(&join_ga);
@@ -6139,12 +6139,12 @@ dict_free (
if (recurse || (di->di_tv.v_type != VAR_LIST
&& di->di_tv.v_type != VAR_DICT))
clear_tv(&di->di_tv);
- vim_free(di);
+ free(di);
--todo;
}
}
hash_clear(&d->dv_hashtab);
- vim_free(d);
+ free(d);
}
/*
@@ -6203,7 +6203,7 @@ static void dictitem_remove(dict_T *dict, dictitem_T *item)
void dictitem_free(dictitem_T *item)
{
clear_tv(&item->di_tv);
- vim_free(item);
+ free(item);
}
/*
@@ -6239,7 +6239,7 @@ static dict_T *dict_copy(dict_T *orig, int deep, int copyID)
if (deep) {
if (item_copy(&HI2DI(hi)->di_tv, &di->di_tv, deep,
copyID) == FAIL) {
- vim_free(di);
+ free(di);
break;
}
} else
@@ -6355,7 +6355,7 @@ dictitem_T *dict_find(dict_T *d, char_u *key, int len)
}
hi = hash_find(&d->dv_hashtab, akey);
- vim_free(tofree);
+ free(tofree);
if (HASHITEM_EMPTY(hi))
return NULL;
return HI2DI(hi);
@@ -6427,19 +6427,19 @@ static char_u *dict2string(typval_T *tv, int copyID)
tofree = string_quote(hi->hi_key, FALSE);
if (tofree != NULL) {
ga_concat(&ga, tofree);
- vim_free(tofree);
+ free(tofree);
}
ga_concat(&ga, (char_u *)": ");
s = tv2string(&HI2DI(hi)->di_tv, &tofree, numbuf, copyID);
if (s != NULL)
ga_concat(&ga, s);
- vim_free(tofree);
+ free(tofree);
if (s == NULL)
break;
}
}
if (todo > 0) {
- vim_free(ga.ga_data);
+ free(ga.ga_data);
return NULL;
}
@@ -6738,7 +6738,7 @@ static int get_env_tv(char_u **arg, typval_T *rettv, int evaluate)
len = get_env_len(arg);
if (evaluate) {
- if (len == 0) {
+ if (len == 0) {
return FAIL; // Can't be an environment variable.
}
cc = name[len];
@@ -6751,13 +6751,13 @@ static int get_env_tv(char_u **arg, typval_T *rettv, int evaluate)
}
} else {
if (mustfree) {
- vim_free(string);
+ free(string);
}
// Next try expanding things like $VIM and ${HOME}.
string = expand_env_save(name - 1);
if (string != NULL && *string == '$') {
- vim_free(string);
+ free(string);
string = NULL;
}
}
@@ -7420,8 +7420,8 @@ call_func (
}
if (fname != name && fname != fname_buf)
- vim_free(fname);
- vim_free(name);
+ free(fname);
+ free(name);
return ret;
}
@@ -7440,7 +7440,7 @@ static void emsg_funcname(char *ermsg, char_u *name)
p = name;
EMSG2(_(ermsg), p);
if (p != name)
- vim_free(p);
+ free(p);
}
/*
@@ -8547,7 +8547,7 @@ static void f_exists(typval_T *argvars, typval_T *rettv)
p = expand_env_save(p);
if (p != NULL && *p != '$')
n = TRUE;
- vim_free(p);
+ free(p);
}
} else if (*p == '&' || *p == '+') { /* option */
n = (get_option_tv(&p, NULL, TRUE) == OK);
@@ -8583,7 +8583,7 @@ static void f_exists(typval_T *argvars, typval_T *rettv)
if (*p != NUL)
n = FALSE;
- vim_free(tofree);
+ free(tofree);
}
rettv->vval.v_number = n;
@@ -8817,7 +8817,7 @@ static void f_feedkeys(typval_T *argvars, typval_T *rettv)
if (keys_esc != NULL) {
ins_typebuf(keys_esc, (remap ? REMAP_YES : REMAP_NONE),
typebuf.tb_len, !typed, FALSE);
- vim_free(keys_esc);
+ free(keys_esc);
if (vgetc_busy)
typebuf_was_filled = TRUE;
}
@@ -8896,7 +8896,7 @@ static void findfilendir(typval_T *argvars, typval_T *rettv, int find_what)
if (*fname != NUL && !error) {
do {
if (rettv->v_type == VAR_STRING || rettv->v_type == VAR_LIST)
- vim_free(fresult);
+ free(fresult);
fresult = find_file_in_path_option(first ? fname : NULL,
first ? (int)STRLEN(fname) : 0,
0, first, path,
@@ -9160,7 +9160,7 @@ static void f_fnamemodify(typval_T *argvars, typval_T *rettv)
rettv->vval.v_string = NULL;
else
rettv->vval.v_string = vim_strnsave(fname, len);
- vim_free(fbuf);
+ free(fbuf);
}
static void foldclosed_both(typval_T *argvars, typval_T *rettv, int end);
@@ -9645,7 +9645,7 @@ static void f_getcwd(typval_T *argvars, typval_T *rettv)
slash_adjust(rettv->vval.v_string);
#endif
}
- vim_free(cwd);
+ free(cwd);
}
}
@@ -10543,8 +10543,8 @@ static void f_iconv(typval_T *argvars, typval_T *rettv)
rettv->vval.v_string = string_convert(&vimconv, str, NULL);
convert_setup(&vimconv, NULL, NULL);
- vim_free(from);
- vim_free(to);
+ free(from);
+ free(to);
}
/*
@@ -10690,7 +10690,7 @@ static void get_user_input(typval_T *argvars, typval_T *rettv, int inputdialog)
rettv->vval.v_string = vim_strsave(get_tv_string_buf(
&argvars[2], buf));
- vim_free(xp_arg);
+ free(xp_arg);
/* since the user typed this, no need to wait for return */
need_wait_return = FALSE;
@@ -11335,7 +11335,7 @@ static void get_maparg(typval_T *argvars, typval_T *rettv, int exact)
keys = replace_termcodes(keys, &keys_buf, TRUE, TRUE, FALSE);
rhs = check_map(keys, mode, exact, FALSE, abbr, &mp, &buffer_local);
- vim_free(keys_buf);
+ free(keys_buf);
if (!get_dict) {
/* Return a string. */
@@ -11358,8 +11358,8 @@ static void get_maparg(typval_T *argvars, typval_T *rettv, int exact)
dict_add_nr_str(dict, "nowait", mp->m_nowait ? 1L : 0L, NULL);
dict_add_nr_str(dict, "mode", 0L, mapmode);
- vim_free(lhs);
- vim_free(mapmode);
+ free(lhs);
+ free(mapmode);
}
}
@@ -11506,7 +11506,7 @@ static void find_some_match(typval_T *argvars, typval_T *rettv, int type)
match = FALSE;
break;
}
- vim_free(tofree);
+ free(tofree);
str = echo_string(&li->li_tv, &tofree, strbuf, 0);
if (str == NULL)
break;
@@ -11570,7 +11570,7 @@ static void find_some_match(typval_T *argvars, typval_T *rettv, int type)
}
theend:
- vim_free(tofree);
+ free(tofree);
p_cpo = save_cpo;
}
@@ -11763,7 +11763,7 @@ static int mkdir_recurse(char_u *dir, int prot)
r = OK;
else if (mkdir_recurse(updir, prot) == OK)
r = vim_mkdir_emsg(updir, prot);
- vim_free(updir);
+ free(updir);
return r;
}
@@ -12117,7 +12117,7 @@ static void f_readfile(typval_T *argvars, typval_T *rettv)
}
if ((li = listitem_alloc()) == NULL) {
- vim_free(s);
+ free(s);
failed = TRUE;
break;
}
@@ -12218,7 +12218,7 @@ static void f_readfile(typval_T *argvars, typval_T *rettv)
rettv->vval.v_list = list_alloc();
}
- vim_free(prev);
+ free(prev);
fclose(fd);
}
@@ -12376,7 +12376,7 @@ static void f_remove(typval_T *argvars, typval_T *rettv)
/* Remove one item, return its value. */
list_remove(l, item, item);
*rettv = item->li_tv;
- vim_free(item);
+ free(item);
} else {
/* Remove range of items, return list with values. */
end = get_tv_number_chk(&argvars[2], &error);
@@ -12532,8 +12532,8 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
buf[len] = NUL;
if (limit-- == 0) {
- vim_free(p);
- vim_free(remain);
+ free(p);
+ free(remain);
EMSG(_("E655: Too many symbolic links (cycle?)"));
rettv->vval.v_string = NULL;
goto fail;
@@ -12553,7 +12553,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
else {
cpy = concat_str(q - 1, remain);
if (cpy != NULL) {
- vim_free(remain);
+ free(remain);
remain = cpy;
}
}
@@ -12572,11 +12572,11 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
if (cpy != NULL) {
STRCPY(cpy, p);
STRCPY(path_tail(cpy), buf);
- vim_free(p);
+ free(p);
p = cpy;
}
} else {
- vim_free(p);
+ free(p);
p = vim_strsave(buf);
}
}
@@ -12590,14 +12590,14 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
cpy = vim_strnsave(p, STRLEN(p) + len);
if (cpy != NULL) {
STRNCAT(cpy, remain, len);
- vim_free(p);
+ free(p);
p = cpy;
}
/* Shorten "remain". */
if (*q != NUL)
STRMOVE(remain, q - 1);
else {
- vim_free(remain);
+ free(remain);
remain = NULL;
}
}
@@ -12616,7 +12616,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
/* Prepend "./". */
cpy = concat_str((char_u *)"./", p);
if (cpy != NULL) {
- vim_free(p);
+ free(p);
p = cpy;
}
} else if (!is_relative_to_current) {
@@ -12648,7 +12648,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
#ifdef HAVE_READLINK
fail:
- vim_free(buf);
+ free(buf);
#endif
rettv->v_type = VAR_STRING;
}
@@ -13177,8 +13177,8 @@ do_searchpair (
curwin->w_cursor = save_cursor;
theend:
- vim_free(pat2);
- vim_free(pat3);
+ free(pat2);
+ free(pat3);
if (p_cpo == empty_option)
p_cpo = save_cpo;
else
@@ -13265,7 +13265,7 @@ static void f_setbufvar(typval_T *argvars, typval_T *rettv)
STRCPY(bufvarname, "b:");
STRCPY(bufvarname + 2, varname);
set_var(bufvarname, varp, TRUE);
- vim_free(bufvarname);
+ free(bufvarname);
}
}
@@ -13577,7 +13577,7 @@ static void f_settabvar(typval_T *argvars, typval_T *rettv)
STRCPY(tabvarname, "t:");
STRCPY(tabvarname + 2, varname);
set_var(tabvarname, varp, TRUE);
- vim_free(tabvarname);
+ free(tabvarname);
}
/* Restore current tabpage */
@@ -13647,7 +13647,7 @@ static void setwinvar(typval_T *argvars, typval_T *rettv, int off)
STRCPY(winvarname, "w:");
STRCPY(winvarname + 2, varname);
set_var(winvarname, varp, TRUE);
- vim_free(winvarname);
+ free(winvarname);
}
}
@@ -13760,8 +13760,8 @@ static int item_compare(const void *s1, const void *s2)
res = STRICMP(p1, p2);
else
res = STRCMP(p1, p2);
- vim_free(tofree1);
- vim_free(tofree2);
+ free(tofree1);
+ free(tofree2);
return res;
}
@@ -13920,7 +13920,7 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort)
}
}
- vim_free(ptrs);
+ free(ptrs);
}
}
@@ -14026,7 +14026,7 @@ static void f_spellsuggest(typval_T *argvars, typval_T *rettv)
li = listitem_alloc();
if (li == NULL)
- vim_free(str);
+ free(str);
else {
li->li_tv.v_type = VAR_STRING;
li->li_tv.v_lock = 0;
@@ -14194,7 +14194,7 @@ static void f_strftime(typval_T *argvars, typval_T *rettv)
result_buf[0] = NUL;
if (conv.vc_type != CONV_NONE)
- vim_free(p);
+ free(p);
convert_setup(&conv, enc, p_enc);
if (conv.vc_type != CONV_NONE)
rettv->vval.v_string = string_convert(&conv, result_buf, NULL);
@@ -14203,7 +14203,7 @@ static void f_strftime(typval_T *argvars, typval_T *rettv)
/* Release conversion descriptors */
convert_setup(&conv, NULL, NULL);
- vim_free(enc);
+ free(enc);
}
}
@@ -14720,7 +14720,7 @@ static void f_system(typval_T *argvars, typval_T *rettv)
done:
if (infile != NULL) {
os_remove((char *)infile);
- vim_free(infile);
+ free(infile);
}
rettv->v_type = VAR_STRING;
rettv->vval.v_string = res;
@@ -14851,7 +14851,7 @@ static void f_tagfiles(typval_T *argvars, typval_T *rettv)
}
tagname_free(&tn);
- vim_free(fname);
+ free(fname);
}
/*
@@ -15125,7 +15125,7 @@ static void f_undofile(typval_T *argvars, typval_T *rettv)
if (ffname != NULL)
rettv->vval.v_string = u_get_undo_file_name(ffname, FALSE);
- vim_free(ffname);
+ free(ffname);
}
}
}
@@ -15792,7 +15792,7 @@ static char_u *make_expanded_name(char_u *in_start, char_u *expr_start, char_u *
STRCAT(retval, expr_end + 1);
}
}
- vim_free(temp_result);
+ free(temp_result);
*in_end = c1; /* put char back for error messages */
*expr_start = '{';
@@ -15804,7 +15804,7 @@ static char_u *make_expanded_name(char_u *in_start, char_u *expr_start, char_u *
/* Further expansion! */
temp_result = make_expanded_name(retval, expr_start,
expr_end, temp_result);
- vim_free(retval);
+ free(retval);
retval = temp_result;
}
}
@@ -15905,7 +15905,7 @@ set_vim_var_string (
* Will always be invoked when "v:progname" is set. */
vimvars[VV_VERSION].vv_nr = VIM_VERSION_100;
- vim_free(vimvars[idx].vv_str);
+ free(vimvars[idx].vv_str);
if (val == NULL)
vimvars[idx].vv_str = NULL;
else if (len == -1)
@@ -15985,7 +15985,7 @@ char_u *set_cmdarg(exarg_T *eap, char_u *oldarg)
oldval = vimvars[VV_CMDARG].vv_str;
if (eap == NULL) {
- vim_free(oldval);
+ free(oldval);
vimvars[VV_CMDARG].vv_str = oldarg;
return NULL;
}
@@ -16171,7 +16171,7 @@ void free_tv(typval_T *varp)
func_unref(varp->vval.v_string);
/*FALLTHROUGH*/
case VAR_STRING:
- vim_free(varp->vval.v_string);
+ free(varp->vval.v_string);
break;
case VAR_LIST:
list_unref(varp->vval.v_list);
@@ -16187,7 +16187,7 @@ void free_tv(typval_T *varp)
EMSG2(_(e_intern2), "free_tv()");
break;
}
- vim_free(varp);
+ free(varp);
}
}
@@ -16202,7 +16202,7 @@ void clear_tv(typval_T *varp)
func_unref(varp->vval.v_string);
/*FALLTHROUGH*/
case VAR_STRING:
- vim_free(varp->vval.v_string);
+ free(varp->vval.v_string);
varp->vval.v_string = NULL;
break;
case VAR_LIST:
@@ -16602,7 +16602,7 @@ static void vars_clear_ext(hashtab_T *ht, int free_val)
if (free_val)
clear_tv(&v->di_tv);
if ((v->di_flags & DI_FLAGS_FIX) == 0)
- vim_free(v);
+ free(v);
}
}
hash_clear(ht);
@@ -16619,7 +16619,7 @@ static void delete_var(hashtab_T *ht, hashitem_T *hi)
hash_remove(ht, hi);
clear_tv(&di->di_tv);
- vim_free(di);
+ free(di);
}
/*
@@ -16635,7 +16635,7 @@ static void list_one_var(dictitem_T *v, char_u *prefix, int *first)
s = echo_string(&v->di_tv, &tofree, numbuf, current_copyID);
list_one_var_a(prefix, v->di_key, v->di_tv.v_type,
s == NULL ? (char_u *)"" : s, first);
- vim_free(tofree);
+ free(tofree);
}
static void
@@ -16730,7 +16730,7 @@ set_var (
*/
if (ht == &vimvarht) {
if (v->di_tv.v_type == VAR_STRING) {
- vim_free(v->di_tv.vval.v_string);
+ free(v->di_tv.vval.v_string);
if (copy || tv->v_type != VAR_STRING)
v->di_tv.vval.v_string = vim_strsave(get_tv_string(tv));
else {
@@ -16770,7 +16770,7 @@ set_var (
return;
STRCPY(v->di_key, varname);
if (hash_add(ht, DI2HIKEY(v)) == FAIL) {
- vim_free(v);
+ free(v);
return;
}
v->di_flags = 0;
@@ -17061,7 +17061,7 @@ void ex_echo(exarg_T *eap)
(void)msg_outtrans_len_attr(p, 1, echo_attr);
}
}
- vim_free(tofree);
+ free(tofree);
}
clear_tv(&rettv);
arg = skipwhite(arg);
@@ -17309,7 +17309,7 @@ void ex_function(exarg_T *eap)
if (!aborting()) {
if (!eap->skip && fudi.fd_newkey != NULL)
EMSG2(_(e_dictkey), fudi.fd_newkey);
- vim_free(fudi.fd_newkey);
+ free(fudi.fd_newkey);
return;
} else
eap->skip = TRUE;
@@ -17430,7 +17430,7 @@ void ex_function(exarg_T *eap)
for (i = 0; i < newargs.ga_len; ++i)
if (STRCMP(((char_u **)(newargs.ga_data))[i], arg) == 0) {
EMSG2(_("E853: Duplicate argument name: %s"), arg);
- vim_free(arg);
+ free(arg);
goto erret;
}
@@ -17536,7 +17536,7 @@ void ex_function(exarg_T *eap)
/* between ":append" and "." and between ":python <<EOF" and "EOF"
* don't check for ":endfunc". */
if (STRCMP(theline, skip_until) == 0) {
- vim_free(skip_until);
+ free(skip_until);
skip_until = NULL;
}
} else {
@@ -17547,7 +17547,7 @@ void ex_function(exarg_T *eap)
/* Check for "endfunction". */
if (checkforcmd(&p, "endfunction", 4) && nesting-- == 0) {
if (line_arg == NULL)
- vim_free(theline);
+ free(theline);
break;
}
@@ -17567,7 +17567,7 @@ void ex_function(exarg_T *eap)
p = skipwhite(p + 1);
p += eval_fname_script(p);
if (ASCII_ISALPHA(*p)) {
- vim_free(trans_function_name(&p, TRUE, 0, NULL));
+ free(trans_function_name(&p, TRUE, 0, NULL));
if (*skipwhite(p) == '(') {
++nesting;
indent += 2;
@@ -17618,7 +17618,7 @@ void ex_function(exarg_T *eap)
p = vim_strsave(theline);
if (p != NULL) {
if (line_arg == NULL)
- vim_free(theline);
+ free(theline);
theline = p;
}
@@ -17664,7 +17664,7 @@ void ex_function(exarg_T *eap)
/* redefine existing function */
ga_clear_strings(&(fp->uf_args));
ga_clear_strings(&(fp->uf_lines));
- vim_free(name);
+ free(name);
name = NULL;
}
} else {
@@ -17686,7 +17686,7 @@ void ex_function(exarg_T *eap)
/* Give the function a sequential number. Can only be used with a
* Funcref! */
- vim_free(name);
+ free(name);
sprintf(numbuf, "%d", ++func_nr);
name = vim_strsave((char_u *)numbuf);
if (name == NULL)
@@ -17709,7 +17709,7 @@ void ex_function(exarg_T *eap)
if (slen > plen && fnamecmp(p,
sourcing_name + slen - plen) == 0)
j = OK;
- vim_free(scriptname);
+ free(scriptname);
}
}
if (j == FAIL) {
@@ -17729,12 +17729,12 @@ void ex_function(exarg_T *eap)
/* add new dict entry */
fudi.fd_di = dictitem_alloc(fudi.fd_newkey);
if (fudi.fd_di == NULL) {
- vim_free(fp);
+ free(fp);
goto erret;
}
if (dict_add(fudi.fd_dict, fudi.fd_di) == FAIL) {
- vim_free(fudi.fd_di);
- vim_free(fp);
+ free(fudi.fd_di);
+ free(fp);
goto erret;
}
} else
@@ -17771,9 +17771,9 @@ erret:
ga_clear_strings(&newargs);
ga_clear_strings(&newlines);
ret_free:
- vim_free(skip_until);
- vim_free(fudi.fd_newkey);
- vim_free(name);
+ free(skip_until);
+ free(fudi.fd_newkey);
+ free(name);
did_emsg |= saved_did_emsg;
need_wait_return |= saved_wait_return;
}
@@ -18088,7 +18088,7 @@ static int function_exists(char_u *name)
* "funcname(...", not "funcname!...". */
if (p != NULL && (*nm == NUL || *nm == '('))
n = translated_function_exists(p);
- vim_free(p);
+ free(p);
return n;
}
@@ -18103,7 +18103,7 @@ char_u *get_expanded_name(char_u *name, int check)
if (!check || translated_function_exists(p))
return p;
- vim_free(p);
+ free(p);
return NULL;
}
@@ -18215,7 +18215,7 @@ void func_dump_profile(FILE *fd)
prof_sort_list(fd, sorttab, st_len, "SELF", TRUE);
}
- vim_free(sorttab);
+ free(sorttab);
}
static void
@@ -18335,7 +18335,7 @@ script_autoload (
ret = TRUE;
}
- vim_free(tofree);
+ free(tofree);
return ret;
}
@@ -18427,14 +18427,14 @@ void ex_delfunction(exarg_T *eap)
p = eap->arg;
name = trans_function_name(&p, eap->skip, 0, &fudi);
- vim_free(fudi.fd_newkey);
+ free(fudi.fd_newkey);
if (name == NULL) {
if (fudi.fd_dict != NULL && !eap->skip)
EMSG(_(e_funcref));
return;
}
if (!ends_excmd(*skipwhite(p))) {
- vim_free(name);
+ free(name);
EMSG(_(e_trailing));
return;
}
@@ -18444,7 +18444,7 @@ void ex_delfunction(exarg_T *eap)
if (!eap->skip)
fp = find_func(name);
- vim_free(name);
+ free(name);
if (!eap->skip) {
if (fp == NULL) {
@@ -18475,9 +18475,9 @@ static void func_free(ufunc_T *fp)
/* clear this function */
ga_clear_strings(&(fp->uf_args));
ga_clear_strings(&(fp->uf_lines));
- vim_free(fp->uf_tml_count);
- vim_free(fp->uf_tml_total);
- vim_free(fp->uf_tml_self);
+ free(fp->uf_tml_count);
+ free(fp->uf_tml_total);
+ free(fp->uf_tml_self);
/* remove the function from the function hashtable */
hi = hash_find(&func_hashtab, UF2HIKEY(fp));
@@ -18486,7 +18486,7 @@ static void func_free(ufunc_T *fp)
else
hash_remove(&func_hashtab, hi);
- vim_free(fp);
+ free(fp);
}
/*
@@ -18709,7 +18709,7 @@ call_user_func (
s = buf;
}
msg_puts(s);
- vim_free(tofree);
+ free(tofree);
}
}
}
@@ -18791,7 +18791,7 @@ call_user_func (
s = buf;
}
smsg((char_u *)_("%s returning %s"), sourcing_name, s);
- vim_free(tofree);
+ free(tofree);
}
}
msg_puts((char_u *)"\n"); /* don't overwrite this either */
@@ -18800,7 +18800,7 @@ call_user_func (
--no_wait_return;
}
- vim_free(sourcing_name);
+ free(sourcing_name);
sourcing_name = save_sourcing_name;
sourcing_lnum = save_sourcing_lnum;
current_SID = save_current_SID;
@@ -18889,7 +18889,7 @@ free_funccal (
for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next)
clear_tv(&li->li_tv);
- vim_free(fc);
+ free(fc);
}
/*
@@ -19016,7 +19016,7 @@ int do_return(exarg_T *eap, int reanimate, int is_cmd, void *rettv)
clear_tv(current_funccal->rettv);
*current_funccal->rettv = *(typval_T *)rettv;
if (!is_cmd)
- vim_free(rettv);
+ free(rettv);
}
}
@@ -19050,7 +19050,7 @@ char_u *get_return_cmd(void *rettv)
STRNCPY(IObuff + 8, s, IOSIZE - 8);
if (STRLEN(s) + 8 >= IOSIZE)
STRCPY(IObuff + IOSIZE - 4, "...");
- vim_free(tofree);
+ free(tofree);
return vim_strsave(IObuff);
}
@@ -19244,16 +19244,16 @@ int read_viminfo_varlist(vir_T *virp, int writing)
* string. */
tv.v_type = VAR_STRING;
else {
- vim_free(tv.vval.v_string);
+ free(tv.vval.v_string);
tv = *etv;
- vim_free(etv);
+ free(etv);
}
}
set_var(virp->vir_line + 1, &tv, FALSE);
if (tv.v_type == VAR_STRING)
- vim_free(tv.vval.v_string);
+ free(tv.vval.v_string);
else if (tv.v_type == VAR_DICT || tv.v_type == VAR_LIST)
clear_tv(&tv);
}
@@ -19299,7 +19299,7 @@ void write_viminfo_varlist(FILE *fp)
p = echo_string(&this_var->di_tv, &tofree, numbuf, 0);
if (p != NULL)
viminfo_writestring(fp, p);
- vim_free(tofree);
+ free(tofree);
}
}
}
@@ -19339,10 +19339,10 @@ int store_session_globals(FILE *fd)
(this_var->di_tv.v_type == VAR_STRING) ? '"'
: ' ') < 0)
|| put_eol(fd) == FAIL) {
- vim_free(p);
+ free(p);
return FAIL;
}
- vim_free(p);
+ free(p);
} else if (this_var->di_tv.v_type == VAR_FLOAT
&& var_flavour(this_var->di_key) == VAR_FLAVOUR_SESSION) {
float_T f = this_var->di_tv.vval.v_float;
@@ -19376,7 +19376,7 @@ void last_set_msg(scid_T scriptID)
verbose_enter();
MSG_PUTS(_("\n\tLast set from "));
MSG_PUTS(p);
- vim_free(p);
+ free(p);
verbose_leave();
}
}
@@ -19457,7 +19457,7 @@ repeat:
#endif
) {
*fnamep = expand_env_save(*fnamep);
- vim_free(*bufp); /* free any allocated file name */
+ free(*bufp); /* free any allocated file name */
*bufp = *fnamep;
if (*fnamep == NULL)
return -1;
@@ -19477,7 +19477,7 @@ repeat:
/* FullName_save() is slow, don't use it when not needed. */
if (*p != NUL || !vim_isAbsName(*fnamep)) {
*fnamep = FullName_save(*fnamep, *p != NUL);
- vim_free(*bufp); /* free any allocated file name */
+ free(*bufp); /* free any allocated file name */
*bufp = *fnamep;
if (*fnamep == NULL)
return -1;
@@ -19487,7 +19487,7 @@ repeat:
if (os_isdir(*fnamep)) {
/* Make room for one or two extra characters. */
*fnamep = vim_strnsave(*fnamep, (int)STRLEN(*fnamep) + 2);
- vim_free(*bufp); /* free any allocated file name */
+ free(*bufp); /* free any allocated file name */
*bufp = *fnamep;
if (*fnamep == NULL)
return -1;
@@ -19523,7 +19523,7 @@ repeat:
if (s != NULL) {
*fnamep = s;
if (pbuf != NULL) {
- vim_free(*bufp); /* free any allocated file name */
+ free(*bufp); /* free any allocated file name */
*bufp = pbuf;
pbuf = NULL;
}
@@ -19535,12 +19535,12 @@ repeat:
s = vim_strsave(dirname);
if (s != NULL) {
*fnamep = s;
- vim_free(*bufp);
+ free(*bufp);
*bufp = s;
}
}
}
- vim_free(pbuf);
+ free(pbuf);
}
}
@@ -19561,7 +19561,7 @@ repeat:
p = vim_strsave((char_u *)".");
if (p == NULL)
return -1;
- vim_free(*bufp);
+ free(*bufp);
*bufp = *fnamep = tail = p;
*fnamelen = 1;
} else {
@@ -19649,15 +19649,15 @@ repeat:
if (s != NULL) {
*fnamep = s;
*fnamelen = (int)STRLEN(s);
- vim_free(*bufp);
+ free(*bufp);
*bufp = s;
didit = TRUE;
}
}
- vim_free(sub);
- vim_free(str);
+ free(sub);
+ free(str);
}
- vim_free(pat);
+ free(pat);
}
}
/* after using ":s", repeat all the modifiers */
@@ -19668,7 +19668,7 @@ repeat:
if (src[*usedlen] == ':' && src[*usedlen + 1] == 'S') {
p = vim_strsave_shellescape(*fnamep, false, false);
- vim_free(*bufp);
+ free(*bufp);
*bufp = *fnamep = p;
*fnamelen = (int)STRLEN(p);
*usedlen += 2;
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 7723dda267..6a6b2fc615 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -533,9 +533,9 @@ void ex_sort(exarg_T *eap)
beginline(BL_WHITE | BL_FIX);
sortend:
- vim_free(nrs);
- vim_free(sortbuf1);
- vim_free(sortbuf2);
+ free(nrs);
+ free(sortbuf1);
+ free(sortbuf2);
vim_regfree(regmatch.regprog);
if (got_int)
EMSG(_(e_interr));
@@ -701,7 +701,7 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
str = vim_strsave(ml_get(l + extra));
if (str != NULL) {
ml_append(dest + l - line1, str, (colnr_T)0, FALSE);
- vim_free(str);
+ free(str);
if (dest < line1)
extra++;
}
@@ -809,7 +809,7 @@ void ex_copy(linenr_T line1, linenr_T line2, linenr_T n)
p = vim_strsave(ml_get(line1));
if (p != NULL) {
ml_append(curwin->w_cursor.lnum, p, (colnr_T)0, FALSE);
- vim_free(p);
+ free(p);
}
/* situation 2: skip already copied lines */
if (line1 == n)
@@ -832,7 +832,7 @@ static char_u *prevcmd = NULL; /* the previous command */
#if defined(EXITFREE) || defined(PROTO)
void free_prev_shellcmd(void)
{
- vim_free(prevcmd);
+ free(prevcmd);
}
#endif
@@ -883,7 +883,7 @@ void do_bang(int addr_count, exarg_T *eap, int forceit, int do_in, int do_out)
if (ins_prevcmd) {
if (prevcmd == NULL) {
EMSG(_(e_noprev));
- vim_free(newcmd);
+ free(newcmd);
return;
}
len += (int)STRLEN(prevcmd);
@@ -896,7 +896,7 @@ void do_bang(int addr_count, exarg_T *eap, int forceit, int do_in, int do_out)
STRCAT(t, prevcmd);
p = t + STRLEN(t);
STRCAT(t, trailarg);
- vim_free(newcmd);
+ free(newcmd);
newcmd = t;
/*
@@ -919,7 +919,7 @@ void do_bang(int addr_count, exarg_T *eap, int forceit, int do_in, int do_out)
}
} while (trailarg != NULL);
- vim_free(prevcmd);
+ free(prevcmd);
prevcmd = newcmd;
if (bangredo) { /* put cmd in redo buffer for ! command */
@@ -929,7 +929,7 @@ void do_bang(int addr_count, exarg_T *eap, int forceit, int do_in, int do_out)
char_u *cmd = vim_strsave_escaped(prevcmd, (char_u *)"%#");
AppendToRedobuffLit(cmd, -1);
- vim_free(cmd);
+ free(cmd);
AppendToRedobuff((char_u *)"\n");
bangredo = FALSE;
}
@@ -960,7 +960,7 @@ void do_bang(int addr_count, exarg_T *eap, int forceit, int do_in, int do_out)
apply_autocmds(EVENT_SHELLFILTERPOST, NULL, NULL, FALSE, curbuf);
}
if (free_newcmd)
- vim_free(newcmd);
+ free(newcmd);
}
/*
@@ -1085,7 +1085,7 @@ do_filter (
if (do_out) {
if (u_save((linenr_T)(line2), (linenr_T)(line2 + 1)) == FAIL) {
- vim_free(cmd_buf);
+ free(cmd_buf);
goto error;
}
redraw_curbuf_later(VALID);
@@ -1109,7 +1109,7 @@ do_filter (
redraw_later_clear();
wait_return(FALSE);
}
- vim_free(cmd_buf);
+ free(cmd_buf);
did_check_timestamps = FALSE;
need_check_timestamps = TRUE;
@@ -1206,8 +1206,8 @@ filterend:
os_remove((char *)itmp);
if (otmp != NULL)
os_remove((char *)otmp);
- vim_free(itmp);
- vim_free(otmp);
+ free(itmp);
+ free(otmp);
}
/*
@@ -1480,7 +1480,7 @@ read_viminfo (
verbose_leave();
}
- vim_free(fname);
+ free(fname);
if (fp == NULL)
return FAIL;
@@ -1590,7 +1590,7 @@ void write_viminfo(char_u *file, int forceit)
* write the viminfo file then.
*/
if (*wp == 'a') {
- vim_free(tempname);
+ free(tempname);
tempname = NULL;
break;
}
@@ -1626,7 +1626,7 @@ void write_viminfo(char_u *file, int forceit)
* "normal" temp file.
*/
if (fp_out == NULL) {
- vim_free(tempname);
+ free(tempname);
if ((tempname = vim_tempname('o')) != NULL)
fp_out = mch_fopen((char *)tempname, WRITEBIN);
}
@@ -1676,8 +1676,8 @@ void write_viminfo(char_u *file, int forceit)
}
end:
- vim_free(fname);
- vim_free(tempname);
+ free(fname);
+ free(tempname);
}
/*
@@ -1758,7 +1758,7 @@ static void do_viminfo(FILE *fp_in, FILE *fp_out, int flags)
&& (flags & (VIF_WANT_MARKS | VIF_GET_OLDFILES | VIF_FORCEIT)))
copy_viminfo_marks(&vir, fp_out, count, eof, flags);
- vim_free(vir.vir_line);
+ free(vir.vir_line);
if (vir.vir_conv.vc_type != CONV_NONE)
convert_setup(&vir.vir_conv, NULL, NULL);
}
@@ -1929,7 +1929,7 @@ viminfo_readstring (
if (convert && virp->vir_conv.vc_type != CONV_NONE && *retval != NUL) {
d = string_convert(&virp->vir_conv, retval, NULL);
if (d != NULL) {
- vim_free(retval);
+ free(retval);
retval = d;
}
}
@@ -2059,8 +2059,8 @@ int rename_buffer(char_u *new_fname)
if (buf != NULL && !cmdmod.keepalt)
curwin->w_alt_fnum = buf->b_fnum;
}
- vim_free(fname);
- vim_free(sfname);
+ free(fname);
+ free(sfname);
apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf);
/* Change directories when the 'acd' option is set. */
do_autochdir();
@@ -2265,7 +2265,7 @@ int do_write(exarg_T *eap)
}
theend:
- vim_free(free_fname);
+ free(free_fname);
return retval;
}
@@ -2338,7 +2338,7 @@ check_overwrite (
copy_option_part(&p, dir, MAXPATHL, ",");
}
swapname = makeswapname(fname, ffname, curbuf, dir);
- vim_free(dir);
+ free(dir);
if (os_file_exists(swapname)) {
if (p_confirm || cmdmod.confirm) {
char_u buff[DIALOG_MSG_SIZE];
@@ -2348,18 +2348,18 @@ check_overwrite (
swapname);
if (vim_dialog_yesno(VIM_QUESTION, NULL, buff, 2)
!= VIM_YES) {
- vim_free(swapname);
+ free(swapname);
return FAIL;
}
eap->forceit = TRUE;
} else {
EMSG2(_("E768: Swap file exists: %s (:silent! overrides)"),
swapname);
- vim_free(swapname);
+ free(swapname);
return FAIL;
}
}
- vim_free(swapname);
+ free(swapname);
}
}
return OK;
@@ -2545,7 +2545,7 @@ int getfile(int fnum, char_u *ffname, char_u *sfname, int setpm, linenr_T lnum,
retval = 1; /* error encountered */
theend:
- vim_free(free_me);
+ free(free_me);
return retval;
}
@@ -2682,7 +2682,7 @@ do_ecmd (
}
set_vim_var_string(VV_SWAPCOMMAND, p, -1);
did_set_swapcommand = TRUE;
- vim_free(p);
+ free(p);
}
/*
@@ -2771,7 +2771,7 @@ do_ecmd (
goto theend;
}
if (aborting()) { /* autocmds may abort script processing */
- vim_free(new_name);
+ free(new_name);
goto theend;
}
if (buf == curbuf) /* already in new buffer */
@@ -2793,7 +2793,7 @@ do_ecmd (
win_close(oldwin, FALSE);
if (aborting()) { /* autocmds may abort script processing */
- vim_free(new_name);
+ free(new_name);
goto theend;
}
/* Be careful again, like above. */
@@ -2831,7 +2831,7 @@ do_ecmd (
did_get_winopts = TRUE;
}
- vim_free(new_name);
+ free(new_name);
au_new_curbuf = NULL;
} else
++curbuf->b_nwindows;
@@ -2943,7 +2943,7 @@ do_ecmd (
delbuf_msg(new_name); /* frees new_name */
goto theend;
}
- vim_free(new_name);
+ free(new_name);
/* If autocommands change buffers under our fingers, forget about
* re-editing the file. Should do the buf_clear_file(), but perhaps
@@ -3141,7 +3141,7 @@ do_ecmd (
theend:
if (did_set_swapcommand)
set_vim_var_string(VV_SWAPCOMMAND, NULL, -1);
- vim_free(free_fname);
+ free(free_fname);
return retval;
}
@@ -3149,7 +3149,7 @@ static void delbuf_msg(char_u *name)
{
EMSG2(_("E143: Autocommands unexpectedly deleted new buffer %s"),
name == NULL ? (char_u *)"" : name);
- vim_free(name);
+ free(name);
au_new_curbuf = NULL;
}
@@ -3235,7 +3235,7 @@ void ex_append(exarg_T *eap)
if ((p[0] == '.' && p[1] == NUL)
|| (!did_undo && u_save(lnum, lnum + 1 + (empty ? 1 : 0))
== FAIL)) {
- vim_free(theline);
+ free(theline);
break;
}
@@ -3247,7 +3247,7 @@ void ex_append(exarg_T *eap)
ml_append(lnum, theline, (colnr_T)0, FALSE);
appended_lines_mark(lnum, 1L);
- vim_free(theline);
+ free(theline);
++lnum;
if (empty) {
@@ -3580,7 +3580,7 @@ void do_sub(exarg_T *eap)
}
sub = old_sub;
} else {
- vim_free(old_sub);
+ free(old_sub);
old_sub = vim_strsave(sub);
}
}
@@ -3834,7 +3834,7 @@ void do_sub(exarg_T *eap)
lnum += regmatch.startpos[0].lnum;
sub_firstlnum += regmatch.startpos[0].lnum;
nmatch -= regmatch.startpos[0].lnum;
- vim_free(sub_firstline);
+ free(sub_firstline);
sub_firstline = NULL;
}
@@ -3938,7 +3938,7 @@ void do_sub(exarg_T *eap)
resp = getexmodeline('?', NULL, 0);
if (resp != NULL) {
typed = *resp;
- vim_free(resp);
+ free(resp);
}
} else {
char_u *orig_line = NULL;
@@ -4159,7 +4159,7 @@ void do_sub(exarg_T *eap)
* line and continue in that one. */
if (nmatch > 1) {
sub_firstlnum += nmatch - 1;
- vim_free(sub_firstline);
+ free(sub_firstline);
sub_firstline = vim_strsave(ml_get(sub_firstlnum));
/* When going beyond the last line, stop substituting. */
if (sub_firstlnum <= line2)
@@ -4174,7 +4174,7 @@ void do_sub(exarg_T *eap)
if (skip_match) {
/* Already hit end of the buffer, sub_firstlnum is one
* less than what it ought to be. */
- vim_free(sub_firstline);
+ free(sub_firstline);
sub_firstline = vim_strsave((char_u *)"");
copycol = 0;
}
@@ -4302,7 +4302,7 @@ skip:
}
sub_firstlnum = lnum;
- vim_free(sub_firstline); /* free the temp buffer */
+ free(sub_firstline); /* free the temp buffer */
sub_firstline = new_start;
new_start = NULL;
matchcol = (colnr_T)STRLEN(sub_firstline) - matchcol;
@@ -4332,8 +4332,8 @@ skip:
if (did_sub)
++sub_nlines;
- vim_free(new_start); /* for when substitute was cancelled */
- vim_free(sub_firstline); /* free the copy of the original line */
+ free(new_start); /* for when substitute was cancelled */
+ free(sub_firstline); /* free the copy of the original line */
sub_firstline = NULL;
}
@@ -4348,7 +4348,7 @@ skip:
changed_lines(first_line, 0, last_line - i, i);
}
- vim_free(sub_firstline); /* may have to free allocated copy of the line */
+ free(sub_firstline); /* may have to free allocated copy of the line */
/* ":s/pat//n" doesn't move the cursor */
if (do_count)
@@ -4608,7 +4608,7 @@ void global_exe(char_u *cmd)
int read_viminfo_sub_string(vir_T *virp, int force)
{
if (force)
- vim_free(old_sub);
+ free(old_sub);
if (force || old_sub == NULL)
old_sub = viminfo_readstring(virp, 1, TRUE);
return viminfo_readline(virp);
@@ -4625,7 +4625,7 @@ void write_viminfo_sub_string(FILE *fp)
#if defined(EXITFREE) || defined(PROTO)
void free_old_sub(void)
{
- vim_free(old_sub);
+ free(old_sub);
}
#endif
@@ -4839,7 +4839,7 @@ void ex_help(exarg_T *eap)
curwin->w_alt_fnum = alt_fnum;
erret:
- vim_free(tag);
+ free(tag);
}
@@ -5103,7 +5103,7 @@ int find_help_tags(char_u *arg, int *num_matches, char_u ***matches, int keep_la
sizeof(char_u *), help_compare);
/* Delete more than TAG_MANY to reduce the size of the listing. */
while (*num_matches > TAG_MANY)
- vim_free((*matches)[--*num_matches]);
+ free((*matches)[--*num_matches]);
}
return OK;
}
@@ -5221,7 +5221,7 @@ void fix_help_buffer(void)
if (fnamecmp(e1, ".txt") != 0
&& fnamecmp(e1, fname + 4) != 0) {
/* Not .txt and not .abx, remove it. */
- vim_free(fnames[i1]);
+ free(fnames[i1]);
fnames[i1] = NULL;
continue;
}
@@ -5230,7 +5230,7 @@ void fix_help_buffer(void)
if (fnamecmp(e1, ".txt") == 0
&& fnamecmp(e2, fname + 4) == 0) {
/* use .abx instead of .txt */
- vim_free(fnames[i1]);
+ free(fnames[i1]);
fnames[i1] = NULL;
}
}
@@ -5289,7 +5289,7 @@ void fix_help_buffer(void)
ml_append(lnum, cp, (colnr_T)0, FALSE);
if (cp != IObuff)
- vim_free(cp);
+ free(cp);
++lnum;
}
fclose(fd);
@@ -5299,7 +5299,7 @@ void fix_help_buffer(void)
}
}
if (mustfree)
- vim_free(rt);
+ free(rt);
}
break;
}
@@ -5365,7 +5365,7 @@ void ex_helptags(exarg_T *eap)
EW_FILE|EW_SILENT) == FAIL
|| filecount == 0) {
EMSG2("E151: No match: %s", NameBuff);
- vim_free(dirname);
+ free(dirname);
return;
}
@@ -5425,7 +5425,7 @@ void ex_helptags(exarg_T *eap)
ga_clear(&ga);
FreeWild(filecount, files);
- vim_free(dirname);
+ free(dirname);
}
static void
@@ -5633,7 +5633,7 @@ helptags_one (
got_int = FALSE; /* continue with other languages */
for (i = 0; i < ga.ga_len; ++i)
- vim_free(((char_u **)ga.ga_data)[i]);
+ free(((char_u **)ga.ga_data)[i]);
ga_clear(&ga);
fclose(fd_tags); /* there is no check for an error... */
}
@@ -5775,7 +5775,7 @@ void ex_sign(exarg_T *eap)
next_sign_typenr = 1;
if (next_sign_typenr == start)
{
- vim_free(sp);
+ free(sp);
EMSG(_("E612: Too many signs defined"));
return;
}
@@ -5792,7 +5792,7 @@ void ex_sign(exarg_T *eap)
sp->sn_name = vim_strsave(arg);
if (sp->sn_name == NULL) /* out of memory */
{
- vim_free(sp);
+ free(sp);
return;
}
@@ -5813,7 +5813,7 @@ void ex_sign(exarg_T *eap)
if (STRNCMP(arg, "icon=", 5) == 0)
{
arg += 5;
- vim_free(sp->sn_icon);
+ free(sp->sn_icon);
sp->sn_icon = vim_strnsave(arg, (int)(p - arg));
backslash_halve(sp->sn_icon);
}
@@ -5852,7 +5852,7 @@ void ex_sign(exarg_T *eap)
return;
}
- vim_free(sp->sn_text);
+ free(sp->sn_text);
/* Allocate one byte more if we need to pad up
* with a space. */
len = (int)(p - arg + ((cells == 1) ? 1 : 0));
@@ -6037,7 +6037,7 @@ void ex_sign(exarg_T *eap)
sprintf((char *)cmd, "e +%" PRId64 " %s",
(int64_t)lnum, buf->b_fname);
do_cmdline_cmd(cmd);
- vim_free(cmd);
+ free(cmd);
}
foldOpenCursor();
@@ -6136,14 +6136,14 @@ sign_undefine(sp, sp_prev)
sign_T *sp;
sign_T *sp_prev;
{
- vim_free(sp->sn_name);
- vim_free(sp->sn_icon);
- vim_free(sp->sn_text);
+ free(sp->sn_name);
+ free(sp->sn_icon);
+ free(sp->sn_text);
if (sp_prev == NULL)
first_sign = sp->sn_next;
else
sp_prev->sn_next = sp->sn_next;
- vim_free(sp);
+ free(sp);
}
/*
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 8546f9d73a..aecd9995ba 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -250,11 +250,11 @@ void do_debug(char_u *cmd)
DOCMD_VERBOSE|DOCMD_EXCRESET);
debug_break_level = n;
- vim_free(cmdline);
+ free(cmdline);
}
lines_left = Rows - 1;
}
- vim_free(cmdline);
+ free(cmdline);
--RedrawingDisabled;
--no_wait_return;
@@ -467,12 +467,12 @@ dbg_parsearg (
if (q == NULL)
return FAIL;
p = expand_env_save(q);
- vim_free(q);
+ free(q);
if (p == NULL)
return FAIL;
if (*p != '*') {
bp->dbg_name = fix_fname(p);
- vim_free(p);
+ free(p);
} else
bp->dbg_name = p;
}
@@ -502,10 +502,10 @@ void ex_breakadd(exarg_T *eap)
pat = file_pat_to_reg_pat(bp->dbg_name, NULL, NULL, FALSE);
if (pat != NULL) {
bp->dbg_prog = vim_regcomp(pat, RE_MAGIC + RE_STRING);
- vim_free(pat);
+ free(pat);
}
if (pat == NULL || bp->dbg_prog == NULL)
- vim_free(bp->dbg_name);
+ free(bp->dbg_name);
else {
if (bp->dbg_lnum == 0) /* default line number is 1 */
bp->dbg_lnum = 1;
@@ -575,14 +575,14 @@ void ex_breakdel(exarg_T *eap)
best_lnum = bpi->dbg_lnum;
}
}
- vim_free(bp->dbg_name);
+ free(bp->dbg_name);
}
if (todel < 0)
EMSG2(_("E161: Breakpoint not found: %s"), eap->arg);
else {
while (gap->ga_len > 0) {
- vim_free(DEBUGGY(gap, todel).dbg_name);
+ free(DEBUGGY(gap, todel).dbg_name);
vim_regfree(DEBUGGY(gap, todel).dbg_prog);
--gap->ga_len;
if (todel < gap->ga_len)
@@ -706,7 +706,7 @@ debuggy_find (
}
}
if (name != fname)
- vim_free(name);
+ free(name);
return lnum;
}
@@ -934,7 +934,7 @@ void ex_profile(exarg_T *eap)
e = skipwhite(e);
if (len == 5 && STRNCMP(eap->arg, "start", 5) == 0 && *e != NUL) {
- vim_free(profile_fname);
+ free(profile_fname);
profile_fname = vim_strsave(e);
do_profiling = PROF_YES;
profile_zero(&prof_wait_time);
@@ -1446,7 +1446,7 @@ buf_found:
set_curbuf(buf, DOBUF_GOTO);
theend:
- vim_free(bufnrs);
+ free(bufnrs);
return ret;
}
@@ -1610,7 +1610,7 @@ do_arglist (
break;
regmatch.regprog = vim_regcomp(p, p_magic ? RE_MAGIC : 0);
if (regmatch.regprog == NULL) {
- vim_free(p);
+ free(p);
break;
}
@@ -1619,7 +1619,7 @@ do_arglist (
if (vim_regexec(&regmatch, alist_name(&ARGLIST[match]),
(colnr_T)0)) {
didone = TRUE;
- vim_free(ARGLIST[match].ae_fname);
+ free(ARGLIST[match].ae_fname);
memmove(ARGLIST + match, ARGLIST + match + 1,
(ARGCOUNT - match - 1) * sizeof(aentry_T));
--ALIST(curwin)->al_ga.ga_len;
@@ -1629,7 +1629,7 @@ do_arglist (
}
vim_regfree(regmatch.regprog);
- vim_free(p);
+ free(p);
if (!didone)
EMSG2(_(e_nomatch2), ((char_u **)new_ga.ga_data)[i]);
}
@@ -1647,7 +1647,7 @@ do_arglist (
if (what == AL_ADD) {
(void)alist_add_list(exp_count, exp_files, after);
- vim_free(exp_files);
+ free(exp_files);
} else /* what == AL_SET */
alist_set(ALIST(curwin), exp_count, exp_files, FALSE, NULL, 0);
}
@@ -1846,7 +1846,7 @@ void do_argfile(exarg_T *eap, int argn)
if (P_HID(curbuf)) {
p = fix_fname(alist_name(&ARGLIST[argn]));
other = otherfile(p);
- vim_free(p);
+ free(p);
}
if ((!P_HID(curbuf) || !other)
&& check_changed(curbuf, CCGD_AW
@@ -1961,7 +1961,7 @@ void ex_argdelete(exarg_T *eap)
EMSG(_(e_invarg));
else {
for (i = eap->line1; i <= eap->line2; ++i)
- vim_free(ARGLIST[i - 1].ae_fname);
+ free(ARGLIST[i - 1].ae_fname);
memmove(ARGLIST + eap->line1 - 1, ARGLIST + eap->line2,
(size_t)((ARGCOUNT - eap->line2) * sizeof(aentry_T)));
ALIST(curwin)->al_ga.ga_len -= n;
@@ -2027,7 +2027,7 @@ void ex_listdo(exarg_T *eap)
set_option_value((char_u *)"shm", 0L, (char_u *)"", 0);
do_argfile(eap, i);
set_option_value((char_u *)"shm", 0L, p_shm_save, 0);
- vim_free(p_shm_save);
+ free(p_shm_save);
}
if (curwin->w_arg_idx != i)
break;
@@ -2078,7 +2078,7 @@ void ex_listdo(exarg_T *eap)
set_option_value((char_u *)"shm", 0L, (char_u *)"", 0);
goto_buffer(eap, DOBUF_FIRST, FORWARD, next_fnum);
set_option_value((char_u *)"shm", 0L, p_shm_save, 0);
- vim_free(p_shm_save);
+ free(p_shm_save);
/* If autocommands took us elsewhere, quit here */
if (curbuf->b_fnum != next_fnum)
@@ -2176,7 +2176,7 @@ void ex_compiler(exarg_T *eap)
sprintf((char *)buf, "compiler/%s.vim", eap->arg);
if (source_runtime(buf, TRUE) == FAIL)
EMSG2(_("E666: compiler not supported: %s"), eap->arg);
- vim_free(buf);
+ free(buf);
do_cmdline_cmd((char_u *)":delcommand CompilerSet");
@@ -2190,7 +2190,7 @@ void ex_compiler(exarg_T *eap)
if (old_cur_comp != NULL) {
set_internal_string_var((char_u *)"g:current_compiler",
old_cur_comp);
- vim_free(old_cur_comp);
+ free(old_cur_comp);
} else
do_unlet((char_u *)"g:current_compiler", TRUE);
}
@@ -2303,8 +2303,8 @@ void *cookie;
}
}
}
- vim_free(buf);
- vim_free(rtp_copy);
+ free(buf);
+ free(rtp_copy);
if (p_verbose > 0 && !did_one && name != NULL) {
verbose_enter();
smsg((char_u *)_("not found in 'runtimepath': \"%s\""), name);
@@ -2472,7 +2472,7 @@ do_source (
if (p == NULL)
return retval;
fname_exp = fix_fname(p);
- vim_free(p);
+ free(p);
if (fname_exp == NULL)
return retval;
if (os_isdir(fname_exp)) {
@@ -2600,7 +2600,7 @@ do_source (
if (p == NULL)
p = vim_strsave(firstline + 3);
if (p != NULL) {
- vim_free(firstline);
+ free(firstline);
firstline = p;
}
}
@@ -2730,12 +2730,12 @@ do_source (
if (do_profiling == PROF_YES)
prof_child_exit(&wait_start); /* leaving a child now */
fclose(cookie.fp);
- vim_free(cookie.nextline);
- vim_free(firstline);
+ free(cookie.nextline);
+ free(firstline);
convert_setup(&cookie.conv, NULL, NULL);
theend:
- vim_free(fname_exp);
+ free(fname_exp);
return retval;
}
@@ -2794,7 +2794,7 @@ void free_scriptnames(void)
int i;
for (i = script_items.ga_len; i > 0; --i)
- vim_free(SCRIPT_ITEM(i).sn_name);
+ free(SCRIPT_ITEM(i).sn_name);
ga_clear(&script_items);
}
@@ -2889,7 +2889,7 @@ char_u *getsourceline(int c, void *cookie, int indent)
ga_concat(&ga, line);
ga_concat(&ga, p + 1);
for (;; ) {
- vim_free(sp->nextline);
+ free(sp->nextline);
sp->nextline = get_one_sourceline(sp);
if (sp->nextline == NULL)
break;
@@ -2907,7 +2907,7 @@ char_u *getsourceline(int c, void *cookie, int indent)
ga_concat(&ga, p + 1);
}
ga_append(&ga, NUL);
- vim_free(line);
+ free(line);
line = ga.ga_data;
}
}
@@ -2918,7 +2918,7 @@ char_u *getsourceline(int c, void *cookie, int indent)
/* Convert the encoding of the script line. */
s = string_convert(&sp->conv, line, NULL);
if (s != NULL) {
- vim_free(line);
+ free(line);
line = s;
}
}
@@ -3061,7 +3061,7 @@ static char_u *get_one_sourceline(struct source_cookie *sp)
if (have_read)
return (char_u *)ga.ga_data;
- vim_free(ga.ga_data);
+ free(ga.ga_data);
return NULL;
}
@@ -3166,7 +3166,7 @@ void ex_scriptencoding(exarg_T *eap)
convert_setup(&sp->conv, name, p_enc);
if (name != eap->arg)
- vim_free(name);
+ free(name);
}
/*
@@ -3499,7 +3499,7 @@ static char_u **find_locales(void)
((char_u **)locales_ga.ga_data)[locales_ga.ga_len++] = loc;
loc = (char_u *)strtok(NULL, "\n");
}
- vim_free(locale_a);
+ free(locale_a);
ga_grow(&locales_ga, 1);
((char_u **)locales_ga.ga_data)[locales_ga.ga_len] = NULL;
return (char_u **)locales_ga.ga_data;
@@ -3511,8 +3511,8 @@ void free_locales(void)
int i;
if (locales != NULL) {
for (i = 0; locales[i] != NULL; i++)
- vim_free(locales[i]);
- vim_free(locales);
+ free(locales[i]);
+ free(locales);
locales = NULL;
}
}
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 6f20c3c60d..87ce252434 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -614,7 +614,7 @@ int flags;
if (cstack.cs_looplevel > 0 && current_line < lines_ga.ga_len) {
/* Each '|' separated command is stored separately in lines_ga, to
* be able to jump to it. Don't use next_cmdline now. */
- vim_free(cmdline_copy);
+ free(cmdline_copy);
cmdline_copy = NULL;
/* Check if a function has returned or, unless it has an unclosed
@@ -710,7 +710,7 @@ int flags;
* Keep the first typed line. Clear it when more lines are typed.
*/
if (flags & DOCMD_KEEPLINE) {
- vim_free(repeat_cmdline);
+ free(repeat_cmdline);
if (count == 0)
repeat_cmdline = vim_strsave(next_cmdline);
else
@@ -789,7 +789,7 @@ int flags;
current_line = cmd_loop_cookie.current_line;
if (next_cmdline == NULL) {
- vim_free(cmdline_copy);
+ free(cmdline_copy);
cmdline_copy = NULL;
/*
* If the command was typed, remember it for the ':' register.
@@ -797,7 +797,7 @@ int flags;
*/
if (getline_equal(fgetline, cookie, getexline)
&& new_last_cmdline != NULL) {
- vim_free(last_cmdline);
+ free(last_cmdline);
last_cmdline = new_last_cmdline;
new_last_cmdline = NULL;
}
@@ -939,7 +939,7 @@ int flags;
|| cstack.cs_idx >= 0
|| (flags & DOCMD_REPEAT)));
- vim_free(cmdline_copy);
+ free(cmdline_copy);
did_emsg_syntax = FALSE;
free_cmdlines(&lines_ga);
ga_clear(&lines_ga);
@@ -1038,15 +1038,15 @@ int flags;
do {
next = messages->next;
emsg(messages->msg);
- vim_free(messages->msg);
- vim_free(messages);
+ free(messages->msg);
+ free(messages);
messages = next;
} while (messages != NULL);
} else if (p != NULL) {
emsg(p);
- vim_free(p);
+ free(p);
}
- vim_free(sourcing_name);
+ free(sourcing_name);
sourcing_name = saved_sourcing_name;
sourcing_lnum = saved_sourcing_lnum;
}
@@ -1188,7 +1188,7 @@ static void store_loop_line(garray_T *gap, char_u *line)
static void free_cmdlines(garray_T *gap)
{
while (gap->ga_len > 0) {
- vim_free(((wcmd_T *)(gap->ga_data))[gap->ga_len - 1].line);
+ free(((wcmd_T *)(gap->ga_data))[gap->ga_len - 1].line);
--gap->ga_len;
}
}
@@ -3471,7 +3471,7 @@ static void ex_script_ni(exarg_T *eap)
if (!eap->skip)
ex_ni(eap);
else
- vim_free(script_get(eap, eap->arg));
+ free(script_get(eap, eap->arg));
}
#endif
@@ -3588,7 +3588,7 @@ static char_u *replace_makeprg(exarg_T *eap, char_u *p, char_u **cmdlinep)
msg_make(p);
/* 'eap->cmd' is not set here, because it is not used at CMD_make */
- vim_free(*cmdlinep);
+ free(*cmdlinep);
*cmdlinep = new_cmdline;
p = new_cmdline;
}
@@ -3652,7 +3652,7 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp)
char_u *l = repl;
repl = expand_env_save(repl);
- vim_free(l);
+ free(l);
}
/* Need to escape white space et al. with a backslash.
@@ -3689,7 +3689,7 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp)
if (vim_strchr(ESCAPE_CHARS, *l) != NULL) {
l = vim_strsave_escaped(repl, ESCAPE_CHARS);
if (l != NULL) {
- vim_free(repl);
+ free(repl);
repl = l;
}
break;
@@ -3703,13 +3703,13 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp)
l = vim_strsave_escaped(repl, (char_u *)"!");
if (l != NULL) {
- vim_free(repl);
+ free(repl);
repl = l;
}
}
p = repl_cmdline(eap, p, srclen, repl, cmdlinep);
- vim_free(repl);
+ free(repl);
}
/*
@@ -3787,7 +3787,7 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp)
if (p != NULL) {
(void)repl_cmdline(eap, eap->arg, (int)STRLEN(eap->arg),
p, cmdlinep);
- vim_free(p);
+ free(p);
}
}
}
@@ -3841,7 +3841,7 @@ static char_u *repl_cmdline(exarg_T *eap, char_u *src, int srclen, char_u *repl,
eap->arg = new_cmdline + (eap->arg - *cmdlinep);
if (eap->do_ecmd_cmd != NULL && eap->do_ecmd_cmd != dollar_command)
eap->do_ecmd_cmd = new_cmdline + (eap->do_ecmd_cmd - *cmdlinep);
- vim_free(*cmdlinep);
+ free(*cmdlinep);
*cmdlinep = new_cmdline;
return src;
@@ -4332,9 +4332,9 @@ static int uc_add_command(char_u *name, size_t name_len, char_u *rep, long argt,
goto fail;
}
- vim_free(cmd->uc_rep);
+ free(cmd->uc_rep);
cmd->uc_rep = NULL;
- vim_free(cmd->uc_compl_arg);
+ free(cmd->uc_compl_arg);
cmd->uc_compl_arg = NULL;
break;
}
@@ -4369,8 +4369,8 @@ static int uc_add_command(char_u *name, size_t name_len, char_u *rep, long argt,
return OK;
fail:
- vim_free(rep_buf);
- vim_free(compl_arg);
+ free(rep_buf);
+ free(compl_arg);
return FAIL;
}
@@ -4732,9 +4732,9 @@ void uc_clear(garray_T *gap)
for (i = 0; i < gap->ga_len; ++i) {
cmd = USER_CMD_GA(gap, i);
- vim_free(cmd->uc_name);
- vim_free(cmd->uc_rep);
- vim_free(cmd->uc_compl_arg);
+ free(cmd->uc_name);
+ free(cmd->uc_rep);
+ free(cmd->uc_compl_arg);
}
ga_clear(gap);
}
@@ -4764,9 +4764,9 @@ static void ex_delcommand(exarg_T *eap)
return;
}
- vim_free(cmd->uc_name);
- vim_free(cmd->uc_rep);
- vim_free(cmd->uc_compl_arg);
+ free(cmd->uc_name);
+ free(cmd->uc_rep);
+ free(cmd->uc_compl_arg);
--gap->ga_len;
@@ -5132,8 +5132,8 @@ static void do_ucmd(exarg_T *eap)
(void)do_cmdline(buf, eap->getline, eap->cookie,
DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED);
current_SID = save_current_SID;
- vim_free(buf);
- vim_free(split_buf);
+ free(buf);
+ free(split_buf);
}
static char_u *get_user_command_name(int idx)
@@ -5259,11 +5259,11 @@ static void ex_colorscheme(exarg_T *eap)
++emsg_off;
p = eval_to_string(expr, NULL, FALSE);
--emsg_off;
- vim_free(expr);
+ free(expr);
}
if (p != NULL) {
MSG(p);
- vim_free(p);
+ free(p);
} else
MSG("default");
} else if (load_colors(eap->arg) == FAIL)
@@ -5670,7 +5670,7 @@ static void ex_goto(exarg_T *eap)
void alist_clear(alist_T *al)
{
while (--al->al_ga.ga_len >= 0)
- vim_free(AARGLIST(al)[al->al_ga.ga_len].ae_fname);
+ free(AARGLIST(al)[al->al_ga.ga_len].ae_fname);
ga_clear(&al->al_ga);
}
@@ -5692,7 +5692,7 @@ void alist_unlink(alist_T *al)
{
if (al != &global_alist && --al->al_refcount <= 0) {
alist_clear(al);
- vim_free(al);
+ free(al);
}
}
@@ -5757,7 +5757,7 @@ void alist_set(alist_T *al, int count, char_u **files, int use_curbuf, int *fnum
/* When adding many buffers this can take a long time. Allow
* interrupting here. */
while (i < count)
- vim_free(files[i++]);
+ free(files[i++]);
break;
}
@@ -5769,7 +5769,7 @@ void alist_set(alist_T *al, int count, char_u **files, int use_curbuf, int *fnum
alist_add(al, files[i], use_curbuf ? 2 : 1);
ui_breakcheck();
}
- vim_free(files);
+ free(files);
}
if (al == &global_alist)
@@ -5925,7 +5925,7 @@ void ex_splitview(exarg_T *eap)
theend:
- vim_free(fname);
+ free(fname);
}
/*
@@ -6101,7 +6101,7 @@ static void ex_find(exarg_T *eap)
* appears several times in the path. */
count = eap->line2;
while (fname != NULL && --count > 0) {
- vim_free(fname);
+ free(fname);
fname = find_file_in_path(NULL, 0, FNAME_MESS,
FALSE, curbuf->b_ffname);
}
@@ -6110,7 +6110,7 @@ static void ex_find(exarg_T *eap)
if (fname != NULL) {
eap->arg = fname;
do_exedit(eap, NULL);
- vim_free(fname);
+ free(fname);
}
}
@@ -6431,10 +6431,10 @@ static char_u *prev_dir = NULL;
#if defined(EXITFREE) || defined(PROTO)
void free_cd_dir(void)
{
- vim_free(prev_dir);
+ free(prev_dir);
prev_dir = NULL;
- vim_free(globaldir);
+ free(globaldir);
globaldir = NULL;
}
@@ -6446,7 +6446,7 @@ void free_cd_dir(void)
*/
void post_chdir(int local)
{
- vim_free(curwin->w_localdir);
+ free(curwin->w_localdir);
curwin->w_localdir = NULL;
if (local) {
/* If still in global directory, need to remember current
@@ -6459,7 +6459,7 @@ void post_chdir(int local)
} else {
/* We are now in the global directory, no need to remember its
* name. */
- vim_free(globaldir);
+ free(globaldir);
globaldir = NULL;
}
@@ -6525,7 +6525,7 @@ void ex_cd(exarg_T *eap)
if (KeyTyped || p_verbose >= 5)
ex_pwd(eap);
}
- vim_free(tofree);
+ free(tofree);
}
}
@@ -6963,7 +6963,7 @@ static void ex_redir(exarg_T *eap)
return;
redir_fd = open_exfile(fname, eap->forceit, mode);
- vim_free(fname);
+ free(fname);
} else if (*arg == '@') {
/* redirect to a register a-z (resp. A-Z for appending) */
close_redir();
@@ -7200,8 +7200,16 @@ static void ex_mkrc(exarg_T *eap)
if (os_chdir((char *)dirnow) != 0)
EMSG(_(e_prev_dir));
shorten_fnames(TRUE);
+ /* restore original dir */
+ if (*dirnow != NUL && ((ssop_flags & SSOP_SESDIR)
+ || ((ssop_flags & SSOP_CURDIR) && globaldir !=
+ NULL))) {
+ if (os_chdir((char *)dirnow) != 0)
+ EMSG(_(e_prev_dir));
+ shorten_fnames(TRUE);
+ }
}
- vim_free(dirnow);
+ free(dirnow);
} else {
failed |= (put_view(fd, curwin, !using_vdir, flagp,
-1) == FAIL);
@@ -7230,14 +7238,14 @@ static void ex_mkrc(exarg_T *eap)
tbuf = xmalloc(MAXPATHL);
if (vim_FullName(fname, tbuf, MAXPATHL, FALSE) == OK)
set_vim_var_string(VV_THIS_SESSION, tbuf, -1);
- vim_free(tbuf);
+ free(tbuf);
}
#ifdef MKSESSION_NL
mksession_nl = FALSE;
#endif
}
- vim_free(viewFile);
+ free(viewFile);
}
int vim_mkdir_emsg(char_u *name, int prot)
@@ -7417,7 +7425,7 @@ static void ex_normal(exarg_T *eap)
/* Restore the state (needed when called from a function executed for
* 'indentexpr'). */
State = save_State;
- vim_free(arg);
+ free(arg);
}
/*
@@ -7837,7 +7845,7 @@ eval_vars (
* postponed to avoid a delay when <afile> is not used. */
autocmd_fname_full = TRUE;
result = FullName_save(autocmd_fname, FALSE);
- vim_free(autocmd_fname);
+ free(autocmd_fname);
autocmd_fname = result;
}
if (result == NULL) {
@@ -7910,7 +7918,7 @@ eval_vars (
result = NULL;
} else
result = vim_strnsave(result, resultlen);
- vim_free(resultbuf);
+ free(resultbuf);
return result;
}
@@ -7997,7 +8005,7 @@ char_u *expand_sfile(char_u *arg)
if (errormsg != NULL) {
if (*errormsg)
emsg(errormsg);
- vim_free(result);
+ free(result);
return NULL;
}
if (repl == NULL) { /* no match (cannot happen) */
@@ -8010,8 +8018,8 @@ char_u *expand_sfile(char_u *arg)
STRCPY(newres + (p - result), repl);
len = (int)STRLEN(newres);
STRCAT(newres, p + srclen);
- vim_free(repl);
- vim_free(result);
+ free(repl);
+ free(result);
result = newres;
p = newres + len; /* continue after the match */
}
@@ -8086,10 +8094,10 @@ makeopens (
|| fputs("cd ", fd) < 0
|| ses_put_fname(fd, sname, &ssop_flags) == FAIL
|| put_eol(fd) == FAIL) {
- vim_free(sname);
+ free(sname);
return FAIL;
}
- vim_free(sname);
+ free(sname);
}
/*
@@ -8655,10 +8663,10 @@ ses_arglist (
}
if (fputs("argadd ", fd) < 0 || ses_put_fname(fd, s, flagp) == FAIL
|| put_eol(fd) == FAIL) {
- vim_free(buf);
+ free(buf);
return FAIL;
}
- vim_free(buf);
+ free(buf);
}
}
return OK;
@@ -8716,7 +8724,7 @@ static int ses_put_fname(FILE *fd, char_u *name, unsigned *flagp)
/* escape special characters */
p = vim_strsave_fnameescape(sname, FALSE);
- vim_free(sname);
+ free(sname);
if (p == NULL)
return FAIL;
@@ -8724,7 +8732,7 @@ static int ses_put_fname(FILE *fd, char_u *name, unsigned *flagp)
if (fputs((char *)p, fd) < 0)
retval = FAIL;
- vim_free(p);
+ free(p);
return retval;
}
@@ -8738,7 +8746,7 @@ static void ex_loadview(exarg_T *eap)
fname = get_view_file(*eap->arg);
if (fname != NULL) {
do_source(fname, FALSE, DOSO_NONE);
- vim_free(fname);
+ free(fname);
}
}
@@ -8793,7 +8801,7 @@ static char_u *get_view_file(int c)
*s++ = c;
STRCPY(s, ".vim");
- vim_free(sname);
+ free(sname);
return retval;
}
@@ -9058,7 +9066,7 @@ static void ex_match(exarg_T *eap)
c = *end;
*end = NUL;
match_add(curwin, g, p + 1, 10, id);
- vim_free(g);
+ free(g);
*end = c;
}
}
diff --git a/src/ex_eval.c b/src/ex_eval.c
index 14226438e6..fc0887ca03 100644
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -250,7 +250,7 @@ int cause_errthrow(char_u *mesg, int severe, int *ignore)
} else {
elem->msg = vim_strsave(mesg);
if (elem->msg == NULL) {
- vim_free(elem);
+ free(elem);
suppress_errthrow = TRUE;
EMSG(_(e_outofmem));
} else {
@@ -289,8 +289,8 @@ static void free_msglist(struct msglist *l)
messages = l;
while (messages != NULL) {
next = messages->next;
- vim_free(messages->msg);
- vim_free(messages);
+ free(messages->msg);
+ free(messages);
messages = next;
}
}
@@ -494,7 +494,7 @@ static int throw_exception(void *value, int type, char_u *cmdname)
? (char_u *)"" : sourcing_name);
if (excp->throw_name == NULL) {
if (should_free)
- vim_free(excp->value);
+ free(excp->value);
goto nomem;
}
excp->throw_lnum = sourcing_lnum;
@@ -526,7 +526,7 @@ static int throw_exception(void *value, int type, char_u *cmdname)
return OK;
nomem:
- vim_free(excp);
+ free(excp);
suppress_errthrow = TRUE;
EMSG(_(e_outofmem));
fail:
@@ -571,14 +571,14 @@ static void discard_exception(except_T *excp, int was_finished)
else
verbose_leave();
STRCPY(IObuff, saved_IObuff);
- vim_free(saved_IObuff);
+ free(saved_IObuff);
}
if (excp->type != ET_INTERRUPT)
- vim_free(excp->value);
+ free(excp->value);
if (excp->type == ET_ERROR)
free_msglist(excp->messages);
- vim_free(excp->throw_name);
- vim_free(excp);
+ free(excp->throw_name);
+ free(excp);
}
/*
@@ -747,9 +747,9 @@ static void report_pending(int action, int pending, void *value)
msg_silent = save_msg_silent;
if (pending == CSTP_RETURN)
- vim_free(s);
+ free(s);
else if (pending & CSTP_THROW)
- vim_free(mesg);
+ free(mesg);
}
/*
@@ -1184,7 +1184,7 @@ void ex_throw(exarg_T *eap)
* not throw. */
if (!eap->skip && value != NULL) {
if (throw_exception(value, ET_USER, NULL) == FAIL)
- vim_free(value);
+ free(value);
else
do_throw(eap->cstack);
}
@@ -2001,7 +2001,7 @@ int cleanup_conditionals(struct condstack *cstack, int searched_cond, int inclus
elem = cstack->cs_emsg_silent_list;
cstack->cs_emsg_silent_list = elem->next;
emsg_silent = elem->saved_emsg_silent;
- vim_free(elem);
+ free(elem);
cstack->cs_flags[idx] &= ~CSF_SILENT;
}
if (stop)
diff --git a/src/ex_getln.c b/src/ex_getln.c
index deb124dbc5..5b6b3c0c27 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -379,7 +379,7 @@ getcmdline (
&& c != K_KPAGEDOWN && c != K_KPAGEUP
&& c != K_LEFT && c != K_RIGHT
&& (xpc.xp_numfiles > 0 || (c != Ctrl_P && c != Ctrl_N))) {
- vim_free(lookfor);
+ free(lookfor);
lookfor = NULL;
}
@@ -618,7 +618,7 @@ getcmdline (
if (realloc_cmdbuff(len + 1) == OK) {
ccline.cmdlen = len;
STRCPY(ccline.cmdbuff, p);
- vim_free(p);
+ free(p);
/* Restore the cursor or use the position set with
* set_cmdline_pos(). */
@@ -854,7 +854,7 @@ getcmdline (
)
goto cmdline_not_changed;
- vim_free(ccline.cmdbuff); /* no commandline to return */
+ free(ccline.cmdbuff); /* no commandline to return */
ccline.cmdbuff = NULL;
if (!cmd_silent) {
if (cmdmsg_rl)
@@ -1246,7 +1246,7 @@ getcmdline (
int len;
int old_firstc;
- vim_free(ccline.cmdbuff);
+ free(ccline.cmdbuff);
xpc.xp_context = EXPAND_NOTHING;
if (hiscnt == hislen)
p = lookfor; /* back to the old one */
@@ -1535,13 +1535,13 @@ returncmd:
add_to_history(histype, ccline.cmdbuff, TRUE,
histype == HIST_SEARCH ? firstc : NUL);
if (firstc == ':') {
- vim_free(new_last_cmdline);
+ free(new_last_cmdline);
new_last_cmdline = vim_strsave(ccline.cmdbuff);
}
}
if (gotesc) { /* abandon command line */
- vim_free(ccline.cmdbuff);
+ free(ccline.cmdbuff);
ccline.cmdbuff = NULL;
if (msg_scrolled == 0)
compute_cmdrow();
@@ -2018,7 +2018,7 @@ static int realloc_cmdbuff(int len)
* there, thus copy up to the NUL and add a NUL. */
memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen);
ccline.cmdbuff[ccline.cmdlen] = NUL;
- vim_free(p);
+ free(p);
if (ccline.xpc != NULL
&& ccline.xpc->xp_pattern != NULL
@@ -2040,7 +2040,7 @@ static char_u *arshape_buf = NULL;
# if defined(EXITFREE) || defined(PROTO)
void free_cmdline_buf(void)
{
- vim_free(arshape_buf);
+ free(arshape_buf);
}
# endif
@@ -2079,7 +2079,7 @@ static void draw_cmdline(int start, int len)
if (len * 2 + 2 > buflen) {
/* Re-allocate the buffer. We keep it around to avoid a lot of
* alloc()/free() calls. */
- vim_free(arshape_buf);
+ free(arshape_buf);
buflen = len * 2 + 2;
arshape_buf = alloc(buflen);
if (arshape_buf == NULL)
@@ -2366,7 +2366,7 @@ void restore_cmdline_alloc(char_u *p)
{
if (p != NULL) {
restore_cmdline((struct cmdline_info *)p);
- vim_free(p);
+ free(p);
}
}
@@ -2444,7 +2444,7 @@ cmdline_paste (
cmdline_paste_str(p, literally);
if (allocated)
- vim_free(arg);
+ free(arg);
return OK;
}
@@ -2693,7 +2693,7 @@ nextwild (
p2 = ExpandOne(xp, p1,
vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len),
use_options, type);
- vim_free(p1);
+ free(p1);
/* longest match: make sure it is not shorter, happens with :help */
if (p2 != NULL && type == WILD_LONGEST) {
for (j = 0; j < xp->xp_pattern_len; ++j)
@@ -2701,7 +2701,7 @@ nextwild (
|| ccline.cmdbuff[i + j] == '?')
break;
if ((int)STRLEN(p2) < j) {
- vim_free(p2);
+ free(p2);
p2 = NULL;
}
}
@@ -2724,7 +2724,7 @@ nextwild (
ccline.cmdpos += difflen;
}
}
- vim_free(p2);
+ free(p2);
redrawcmd();
cursorcmd();
@@ -2836,7 +2836,7 @@ ExpandOne (
if (xp->xp_numfiles != -1 && mode != WILD_ALL && mode != WILD_LONGEST) {
FreeWild(xp->xp_numfiles, xp->xp_files);
xp->xp_numfiles = -1;
- vim_free(orig_save);
+ free(orig_save);
orig_save = NULL;
}
findex = 0;
@@ -2845,7 +2845,7 @@ ExpandOne (
return NULL;
if (xp->xp_numfiles == -1) {
- vim_free(orig_save);
+ free(orig_save);
orig_save = orig;
orig_saved = TRUE;
@@ -2955,7 +2955,7 @@ ExpandOne (
/* Free "orig" if it wasn't stored in "orig_save". */
if (!orig_saved)
- vim_free(orig);
+ free(orig);
return ss;
}
@@ -3014,12 +3014,12 @@ void ExpandEscape(expand_T *xp, char_u *str, int numfiles, char_u **files, int o
if (xp->xp_backslash == XP_BS_THREE) {
p = vim_strsave_escaped(files[i], (char_u *)" ");
if (p != NULL) {
- vim_free(files[i]);
+ free(files[i]);
files[i] = p;
#if defined(BACKSLASH_IN_FILENAME)
p = vim_strsave_escaped(files[i], (char_u *)" ");
if (p != NULL) {
- vim_free(files[i]);
+ free(files[i]);
files[i] = p;
}
#endif
@@ -3031,7 +3031,7 @@ void ExpandEscape(expand_T *xp, char_u *str, int numfiles, char_u **files, int o
p = vim_strsave_fnameescape(files[i], xp->xp_shell);
#endif
if (p != NULL) {
- vim_free(files[i]);
+ free(files[i]);
files[i] = p;
}
@@ -3054,7 +3054,7 @@ void ExpandEscape(expand_T *xp, char_u *str, int numfiles, char_u **files, int o
for (i = 0; i < numfiles; ++i) {
p = vim_strsave_escaped(files[i], (char_u *)"\\|\"");
if (p != NULL) {
- vim_free(files[i]);
+ free(files[i]);
files[i] = p;
}
}
@@ -3088,7 +3088,7 @@ char_u *vim_strsave_fnameescape(char_u *fname, int shell)
/* For csh and similar shells need to put two backslashes before '!'.
* One is taken by Vim, one by the shell. */
s = vim_strsave_escaped(p, (char_u *)"!");
- vim_free(p);
+ free(p);
p = s;
}
#endif
@@ -3112,7 +3112,7 @@ static void escape_fname(char_u **pp)
if (p != NULL) {
p[0] = '\\';
STRCPY(p + 1, *pp);
- vim_free(*pp);
+ free(*pp);
*pp = p;
}
}
@@ -3130,7 +3130,7 @@ void tilde_replace(char_u *orig_pat, int num_files, char_u **files)
for (i = 0; i < num_files; ++i) {
p = home_replace_save(NULL, files[i]);
if (p != NULL) {
- vim_free(files[i]);
+ free(files[i]);
files[i] = p;
}
}
@@ -3250,8 +3250,8 @@ static int showmatches(expand_T *xp, int wildmenu)
exp_path != NULL ? exp_path : files_found[k]);
j = os_isdir(halved_slash != NULL ? halved_slash
: files_found[k]);
- vim_free(exp_path);
- vim_free(halved_slash);
+ free(exp_path);
+ free(halved_slash);
} else
/* Expansion was done here, file names are literal. */
j = os_isdir(files_found[k]);
@@ -3614,7 +3614,7 @@ expand_cmdline (
*matchcount = 0;
*matches = NULL;
}
- vim_free(file_str);
+ free(file_str);
return EXPAND_OK;
}
@@ -3710,7 +3710,7 @@ ExpandFromContext (
/* Expand wildcards, supporting %:h and the like. */
ret = expand_wildcards_eval(&pat, num_file, file, flags);
if (free_pat)
- vim_free(pat);
+ free(pat);
return ret;
}
@@ -3990,9 +3990,9 @@ expand_shellcmd (
STRMOVE(s, s + l);
((char_u **)ga.ga_data)[ga.ga_len++] = s;
} else
- vim_free(s);
+ free(s);
}
- vim_free(*file);
+ free(*file);
}
}
if (*e != NUL)
@@ -4001,10 +4001,10 @@ expand_shellcmd (
*file = ga.ga_data;
*num_file = ga.ga_len;
- vim_free(buf);
- vim_free(pat);
+ free(buf);
+ free(pat);
if (mustfree)
- vim_free(path);
+ free(path);
return OK;
}
@@ -4058,7 +4058,7 @@ char_u ***file;
if (ccline.cmdbuff != NULL)
ccline.cmdbuff[ccline.cmdlen] = keep;
- vim_free(args[0]);
+ free(args[0]);
return ret;
}
@@ -4101,7 +4101,7 @@ static int ExpandUserDefined(expand_T *xp, regmatch_T *regmatch, int *num_file,
if (*e != NUL)
++e;
}
- vim_free(retstr);
+ free(retstr);
*file = ga.ga_data;
*num_file = ga.ga_len;
return OK;
@@ -4166,7 +4166,7 @@ static int ExpandRTDir(char_u *pat, int *num_file, char_u ***file, char *dirname
}
sprintf((char *)s, "%s/%s*.vim", dirnames[i], pat);
matches = globpath(p_rtp, s, 0);
- vim_free(s);
+ free(s);
if (matches == NULL)
continue;
@@ -4187,7 +4187,7 @@ static int ExpandRTDir(char_u *pat, int *num_file, char_u ***file, char *dirname
if (*e != NUL)
++e;
}
- vim_free(matches);
+ free(matches);
}
if (ga.ga_len == 0)
return FAIL;
@@ -4257,7 +4257,7 @@ char_u *globpath(char_u *path, char_u *file, int expand_options)
if (cur != NULL)
*--cur = 0; /* Replace trailing newline with NUL */
- vim_free(buf);
+ free(buf);
return (char_u *)ga.ga_data;
}
@@ -4373,7 +4373,7 @@ void init_history(void)
if (i >= 0) /* copy newest entries */
temp[i] = history[type][j];
else /* remove older entries */
- vim_free(history[type][j].hisstr);
+ free(history[type][j].hisstr);
if (--j < 0)
j = hislen - 1;
if (j == hisidx[type])
@@ -4381,7 +4381,7 @@ void init_history(void)
}
hisidx[type] = newlen - 1;
}
- vim_free(history[type]);
+ free(history[type]);
history[type] = temp;
}
}
@@ -4508,7 +4508,7 @@ add_to_history (
if (maptick == last_maptick) {
/* Current line is from the same mapping, remove it */
hisptr = &history[HIST_SEARCH][hisidx[HIST_SEARCH]];
- vim_free(hisptr->hisstr);
+ free(hisptr->hisstr);
clear_hist_entry(hisptr);
--hisnum[histype];
if (--hisidx[HIST_SEARCH] < 0)
@@ -4520,7 +4520,7 @@ add_to_history (
if (++hisidx[histype] == hislen)
hisidx[histype] = 0;
hisptr = &history[histype][hisidx[histype]];
- vim_free(hisptr->hisstr);
+ free(hisptr->hisstr);
/* Store the separator after the NUL of the string. */
len = (int)STRLEN(new_entry);
@@ -4695,7 +4695,7 @@ int clr_history(int histype)
if (hislen != 0 && histype >= 0 && histype < HIST_COUNT) {
hisptr = history[histype];
for (i = hislen; i--; ) {
- vim_free(hisptr->hisstr);
+ free(hisptr->hisstr);
clear_hist_entry(hisptr);
}
hisidx[histype] = -1; /* mark history as cleared */
@@ -4734,7 +4734,7 @@ int del_history_entry(int histype, char_u *str)
break;
if (vim_regexec(&regmatch, hisptr->hisstr, (colnr_T)0)) {
found = TRUE;
- vim_free(hisptr->hisstr);
+ free(hisptr->hisstr);
clear_hist_entry(hisptr);
} else {
if (i != last) {
@@ -4766,7 +4766,7 @@ int del_history_idx(int histype, int idx)
if (i < 0)
return FALSE;
idx = hisidx[histype];
- vim_free(history[histype][i].hisstr);
+ free(history[histype][i].hisstr);
/* When deleting the last added search string in a mapping, reset
* last_maptick, so that the last added search string isn't deleted again.
@@ -5037,7 +5037,7 @@ int read_viminfo_history(vir_T *virp, int writing)
}
}
}
- vim_free(val);
+ free(val);
}
return viminfo_readline(virp);
}
@@ -5075,7 +5075,7 @@ void finish_viminfo_history(void)
idx = hislen - 1;
}
for (i = 0; i < viminfo_hisidx[type]; i++) {
- vim_free(history[type][idx].hisstr);
+ free(history[type][idx].hisstr);
history[type][idx].hisstr = viminfo_history[type][i];
history[type][idx].viminfo = TRUE;
if (--idx < 0)
@@ -5087,7 +5087,7 @@ void finish_viminfo_history(void)
history[type][idx++].hisnum = ++hisnum[type];
idx %= hislen;
}
- vim_free(viminfo_history[type]);
+ free(viminfo_history[type]);
viminfo_history[type] = NULL;
viminfo_hisidx[type] = 0;
}
@@ -5174,8 +5174,8 @@ void write_viminfo_history(FILE *fp, int merge)
}
for (i = 0; i < viminfo_hisidx[type]; ++i)
if (viminfo_history[type] != NULL)
- vim_free(viminfo_history[type][i]);
- vim_free(viminfo_history[type]);
+ free(viminfo_history[type][i]);
+ free(viminfo_history[type]);
viminfo_history[type] = NULL;
viminfo_hisidx[type] = 0;
}
@@ -5356,7 +5356,7 @@ static int ex_window(void)
if (aborting() && cmdwin_result != K_IGNORE)
cmdwin_result = Ctrl_C;
/* Set the new command line from the cmdline buffer. */
- vim_free(ccline.cmdbuff);
+ free(ccline.cmdbuff);
if (cmdwin_result == K_XF1 || cmdwin_result == K_XF2) { /* :qa[!] typed */
char *p = (cmdwin_result == K_XF2) ? "qa" : "qa!";
@@ -5452,13 +5452,13 @@ char_u *script_get(exarg_T *eap, char_u *cmd)
NUL, eap->cookie, 0);
if (theline == NULL || STRCMP(end_pattern, theline) == 0) {
- vim_free(theline);
+ free(theline);
break;
}
ga_concat(&ga, theline);
ga_append(&ga, '\n');
- vim_free(theline);
+ free(theline);
}
ga_append(&ga, NUL);
diff --git a/src/file_search.c b/src/file_search.c
index 1bcb9fa519..82b9689e09 100644
--- a/src/file_search.c
+++ b/src/file_search.c
@@ -514,19 +514,19 @@ vim_findfile_init (
}
if (temp == NULL || wc_path == NULL) {
- vim_free(buf);
- vim_free(temp);
- vim_free(wc_path);
+ free(buf);
+ free(temp);
+ free(wc_path);
goto error_return;
}
STRCPY(temp, search_ctx->ffsc_fix_path + len);
STRCAT(temp, search_ctx->ffsc_wc_path);
- vim_free(search_ctx->ffsc_wc_path);
- vim_free(wc_path);
+ free(search_ctx->ffsc_wc_path);
+ free(wc_path);
search_ctx->ffsc_wc_path = temp;
}
- vim_free(buf);
+ free(buf);
}
sptr = ff_create_stack_element(ff_expand_buffer,
@@ -588,7 +588,7 @@ void vim_findfile_cleanup(void *ctx)
vim_findfile_free_visited(ctx);
ff_clear(ctx);
- vim_free(ctx);
+ free(ctx);
}
/*
@@ -977,7 +977,7 @@ char_u *vim_findfile(void *search_ctx_arg)
break;
}
- vim_free(file_path);
+ free(file_path);
return NULL;
}
@@ -1005,8 +1005,8 @@ static void vim_findfile_free_visited_list(ff_visited_list_hdr_T **list_headp)
vp = (*list_headp)->ffvl_next;
ff_free_visited_list((*list_headp)->ffvl_visited_list);
- vim_free((*list_headp)->ffvl_filename);
- vim_free(*list_headp);
+ free((*list_headp)->ffvl_filename);
+ free(*list_headp);
*list_headp = vp;
}
*list_headp = NULL;
@@ -1018,8 +1018,8 @@ static void ff_free_visited_list(ff_visited_T *vl)
while (vl != NULL) {
vp = vl->ffv_next;
- vim_free(vl->ffv_wc_path);
- vim_free(vl);
+ free(vl->ffv_wc_path);
+ free(vl);
vl = vp;
}
vl = NULL;
@@ -1072,7 +1072,7 @@ static ff_visited_list_hdr_T *ff_get_visited_list(char_u *filename, ff_visited_l
retptr->ffvl_visited_list = NULL;
retptr->ffvl_filename = vim_strsave(filename);
if (retptr->ffvl_filename == NULL) {
- vim_free(retptr);
+ free(retptr);
return NULL;
}
retptr->ffvl_next = *list_headp;
@@ -1265,14 +1265,14 @@ static ff_stack_T *ff_pop(ff_search_ctx_T *search_ctx)
*/
static void ff_free_stack_element(ff_stack_T *stack_ptr)
{
- /* vim_free handles possible NULL pointers */
- vim_free(stack_ptr->ffs_fix_path);
- vim_free(stack_ptr->ffs_wc_path);
+ /* free handles possible NULL pointers */
+ free(stack_ptr->ffs_fix_path);
+ free(stack_ptr->ffs_wc_path);
if (stack_ptr->ffs_filearray != NULL)
FreeWild(stack_ptr->ffs_filearray_size, stack_ptr->ffs_filearray);
- vim_free(stack_ptr);
+ free(stack_ptr);
}
/*
@@ -1286,19 +1286,19 @@ static void ff_clear(ff_search_ctx_T *search_ctx)
while ((sptr = ff_pop(search_ctx)) != NULL)
ff_free_stack_element(sptr);
- vim_free(search_ctx->ffsc_file_to_search);
- vim_free(search_ctx->ffsc_start_dir);
- vim_free(search_ctx->ffsc_fix_path);
- vim_free(search_ctx->ffsc_wc_path);
+ free(search_ctx->ffsc_file_to_search);
+ free(search_ctx->ffsc_start_dir);
+ free(search_ctx->ffsc_fix_path);
+ free(search_ctx->ffsc_wc_path);
if (search_ctx->ffsc_stopdirs_v != NULL) {
int i = 0;
while (search_ctx->ffsc_stopdirs_v[i] != NULL) {
- vim_free(search_ctx->ffsc_stopdirs_v[i]);
+ free(search_ctx->ffsc_stopdirs_v[i]);
i++;
}
- vim_free(search_ctx->ffsc_stopdirs_v);
+ free(search_ctx->ffsc_stopdirs_v);
}
search_ctx->ffsc_stopdirs_v = NULL;
@@ -1388,9 +1388,9 @@ static void *fdip_search_ctx = NULL;
#if defined(EXITFREE)
void free_findfile(void)
{
- vim_free(ff_file_to_find);
+ free(ff_file_to_find);
vim_findfile_cleanup(fdip_search_ctx);
- vim_free(ff_expand_buffer);
+ free(ff_expand_buffer);
}
#endif
@@ -1443,7 +1443,7 @@ find_file_in_path_option (
expand_env(ptr, NameBuff, MAXPATHL);
ptr[len] = save_char;
- vim_free(ff_file_to_find);
+ free(ff_file_to_find);
ff_file_to_find = vim_strsave(NameBuff);
if (ff_file_to_find == NULL) { /* out of memory */
file_name = NULL;
@@ -1554,7 +1554,7 @@ find_file_in_path_option (
fdip_search_ctx, FALSE, rel_fname);
if (fdip_search_ctx != NULL)
did_findfile_init = TRUE;
- vim_free(buf);
+ free(buf);
}
}
}
diff --git a/src/fileio.c b/src/fileio.c
index 8fc06ecf9f..8f2639064a 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -854,12 +854,12 @@ retry:
notconverted = TRUE;
conv_error = 0;
if (fenc_alloced)
- vim_free(fenc);
+ free(fenc);
fenc = (char_u *)"";
fenc_alloced = FALSE;
} else {
if (fenc_alloced)
- vim_free(fenc);
+ free(fenc);
if (fenc_next != NULL) {
fenc = next_fenc(&fenc_next);
fenc_alloced = (fenc_next != NULL);
@@ -870,7 +870,7 @@ retry:
}
if (tmpname != NULL) {
os_remove((char *)tmpname); // delete converted file
- vim_free(tmpname);
+ free(tmpname);
tmpname = NULL;
}
}
@@ -999,7 +999,7 @@ retry:
}
if (linerest) /* copy characters from the previous buffer */
memmove(new_buffer, ptr - linerest, (size_t)linerest);
- vim_free(buffer);
+ free(buffer);
buffer = new_buffer;
ptr = buffer + linerest;
line_start = buffer;
@@ -1205,7 +1205,7 @@ retry:
} else {
/* BOM detected: set "fenc" and jump back */
if (fenc_alloced)
- vim_free(fenc);
+ free(fenc);
fenc = ccname;
fenc_alloced = FALSE;
}
@@ -1748,7 +1748,7 @@ failed:
set_string_option_direct((char_u *)"fenc", -1, fenc,
OPT_FREE|OPT_LOCAL, 0);
if (fenc_alloced)
- vim_free(fenc);
+ free(fenc);
# ifdef USE_ICONV
if (iconv_fd != (iconv_t)-1) {
iconv_close(iconv_fd);
@@ -1765,7 +1765,7 @@ failed:
fcntl(fd, F_SETFD, fdflags | FD_CLOEXEC);
}
#endif
- vim_free(buffer);
+ free(buffer);
#ifdef HAVE_DUP
if (read_stdin) {
@@ -1777,7 +1777,7 @@ failed:
if (tmpname != NULL) {
os_remove((char *)tmpname); // delete converted file
- vim_free(tmpname);
+ free(tmpname);
}
--no_wait_return; /* may wait for return now */
@@ -1909,7 +1909,7 @@ failed:
else
msg_add_lines(c, (long)linecnt, filesize);
- vim_free(keep_msg);
+ free(keep_msg);
keep_msg = NULL;
msg_scrolled_ign = TRUE;
p = msg_trunc_attr(IObuff, FALSE, 0);
@@ -2110,7 +2110,7 @@ void set_forced_fenc(exarg_T *eap)
if (fenc != NULL)
set_string_option_direct((char_u *)"fenc", -1,
fenc, OPT_FREE|OPT_LOCAL, 0);
- vim_free(fenc);
+ free(fenc);
}
}
@@ -2139,7 +2139,7 @@ static char_u *next_fenc(char_u **pp)
*pp = p + 1;
if (r != NULL) {
p = enc_canonize(r);
- vim_free(r);
+ free(r);
r = p;
}
}
@@ -2188,7 +2188,7 @@ readfile_charconvert (
MSG(errmsg);
if (tmpname != NULL) {
os_remove((char *)tmpname); // delete converted file
- vim_free(tmpname);
+ free(tmpname);
tmpname = NULL;
}
}
@@ -2283,7 +2283,7 @@ check_for_cryptkey (
/* check if empty key entered */
if (cryptkey != NULL && *cryptkey == NUL) {
if (cryptkey != curbuf->b_p_key)
- vim_free(cryptkey);
+ free(cryptkey);
cryptkey = NULL;
}
}
@@ -3041,7 +3041,7 @@ buf_write (
*/
backup = modname(rootname, backup_ext, FALSE);
if (backup == NULL) {
- vim_free(rootname);
+ free(rootname);
some_error = TRUE; /* out of memory */
goto nobackup;
}
@@ -3059,7 +3059,7 @@ buf_write (
*/
if (st_new.st_dev == st_old.st_dev
&& st_new.st_ino == st_old.st_ino) {
- vim_free(backup);
+ free(backup);
backup = NULL; /* no backup file to delete */
}
#endif
@@ -3080,13 +3080,13 @@ buf_write (
--*wp;
/* They all exist??? Must be something wrong. */
if (*wp == 'a') {
- vim_free(backup);
+ free(backup);
backup = NULL;
}
}
}
}
- vim_free(rootname);
+ free(rootname);
/*
* Try to create the backup file
@@ -3100,7 +3100,7 @@ buf_write (
O_WRONLY|O_CREAT|O_EXCL|O_NOFOLLOW,
perm & 0777);
if (bfd < 0) {
- vim_free(backup);
+ free(backup);
backup = NULL;
} else {
/* set file protection same as original file, but
@@ -3169,7 +3169,7 @@ buf_write (
}
nobackup:
close(fd); /* ignore errors for closing read file */
- vim_free(copybuf);
+ free(copybuf);
if (backup == NULL && errmsg == NULL)
errmsg = (char_u *)_(
@@ -3216,7 +3216,7 @@ nobackup:
backup = NULL;
else {
backup = modname(rootname, backup_ext, FALSE);
- vim_free(rootname);
+ free(rootname);
}
if (backup != NULL) {
@@ -3234,7 +3234,7 @@ nobackup:
--*p;
/* They all exist??? Must be something wrong! */
if (*p == 'a') {
- vim_free(backup);
+ free(backup);
backup = NULL;
}
}
@@ -3253,7 +3253,7 @@ nobackup:
if (vim_rename(fname, backup) == 0)
break;
- vim_free(backup); /* don't do the rename below */
+ free(backup); /* don't do the rename below */
backup = NULL;
}
}
@@ -3477,7 +3477,7 @@ restore_backup:
}
if (wfname != fname)
- vim_free(wfname);
+ free(wfname);
goto fail;
}
errmsg = NULL;
@@ -3502,7 +3502,7 @@ restore_backup:
if (buf_write_bytes(&write_info) == FAIL)
end = 0;
wb_flags |= FIO_ENCRYPTED;
- vim_free(header);
+ free(header);
}
}
@@ -3702,7 +3702,7 @@ restore_backup:
}
}
os_remove((char *)wfname);
- vim_free(wfname);
+ free(wfname);
}
if (end == 0) {
@@ -3865,7 +3865,7 @@ restore_backup:
EMSG(_("E205: Patchmode: can't save original file"));
else if (mch_stat(org, &st) < 0) {
vim_rename(backup, (char_u *)org);
- vim_free(backup); /* don't delete the file */
+ free(backup); /* don't delete the file */
backup = NULL;
#ifdef UNIX
set_file_time((char_u *)org, st_old.st_atime, st_old.st_mtime);
@@ -3889,7 +3889,7 @@ restore_backup:
}
if (org != NULL) {
os_setperm((char_u *)org, os_getperm(fname) & 0777);
- vim_free(org);
+ free(org);
}
}
@@ -3912,11 +3912,11 @@ nofail:
/* Done saving, we accept changed buffer warnings again */
buf->b_saving = FALSE;
- vim_free(backup);
+ free(backup);
if (buffer != smallbuf)
- vim_free(buffer);
- vim_free(fenc_tofree);
- vim_free(write_info.bw_conv_buf);
+ free(buffer);
+ free(fenc_tofree);
+ free(write_info.bw_conv_buf);
# ifdef USE_ICONV
if (write_info.bw_iconv_fd != (iconv_t)-1) {
iconv_close(write_info.bw_iconv_fd);
@@ -3949,7 +3949,7 @@ nofail:
STRCAT(IObuff, errmsg);
emsg(IObuff);
if (errmsg_allocated)
- vim_free(errmsg);
+ free(errmsg);
retval = FAIL;
if (end == 0) {
@@ -4608,7 +4608,7 @@ void shorten_fnames(int force)
&& (force
|| buf->b_sfname == NULL
|| path_is_absolute_path(buf->b_sfname))) {
- vim_free(buf->b_sfname);
+ free(buf->b_sfname);
buf->b_sfname = NULL;
p = path_shorten_fname(buf->b_ffname, dirname);
if (p != NULL) {
@@ -4660,7 +4660,7 @@ modname (
retval = alloc((unsigned)(MAXPATHL + extlen + 3));
if (os_dirname(retval, MAXPATHL) == FAIL ||
(fnamelen = (int)STRLEN(retval)) == 0) {
- vim_free(retval);
+ free(retval);
return NULL;
}
if (!after_pathsep(retval, retval + fnamelen)) {
@@ -4941,7 +4941,7 @@ int vim_rename(char_u *from, char_u *to)
break;
}
- vim_free(buffer);
+ free(buffer);
close(fd_in);
if (close(fd_out) < 0)
errmsg = _("E209: Error closing \"%s\"");
@@ -5050,11 +5050,11 @@ static int move_lines(buf_T *frombuf, buf_T *tobuf)
for (lnum = 1; lnum <= frombuf->b_ml.ml_line_count; ++lnum) {
p = vim_strsave(ml_get_buf(frombuf, lnum, FALSE));
if (p == NULL || ml_append(lnum - 1, p, 0, FALSE) == FAIL) {
- vim_free(p);
+ free(p);
retval = FAIL;
break;
}
- vim_free(p);
+ free(p);
}
/* Delete all the lines in "frombuf". */
@@ -5273,8 +5273,8 @@ buf_check_timestamp (
already_warned = TRUE;
}
- vim_free(path);
- vim_free(tbuf);
+ free(path);
+ free(tbuf);
}
}
@@ -5393,7 +5393,7 @@ void buf_reload(buf_T *buf, int orig_mode)
}
}
}
- vim_free(ea.cmd);
+ free(ea.cmd);
if (savebuf != NULL && buf_valid(savebuf))
wipe_buffer(savebuf, FALSE);
@@ -5479,7 +5479,7 @@ void vim_deltempdir(void)
path_tail(NameBuff)[-1] = NUL;
os_rmdir((char *)NameBuff);
- vim_free(vim_tempdir);
+ free(vim_tempdir);
vim_tempdir = NULL;
}
}
@@ -5500,7 +5500,7 @@ static void vim_settempdir(char_u *tempdir)
STRCPY(buf, tempdir);
add_pathsep(buf);
vim_tempdir = vim_strsave(buf);
- vim_free(buf);
+ free(buf);
}
}
#endif
@@ -5943,7 +5943,7 @@ static void show_autocmd(AutoPat *ap, event_T event)
*/
static void au_remove_pat(AutoPat *ap)
{
- vim_free(ap->pat);
+ free(ap->pat);
ap->pat = NULL;
ap->buflocal_nr = -1;
au_need_clean = TRUE;
@@ -5957,7 +5957,7 @@ static void au_remove_cmds(AutoPat *ap)
AutoCmd *ac;
for (ac = ap->cmds; ac != NULL; ac = ac->next) {
- vim_free(ac->cmd);
+ free(ac->cmd);
ac->cmd = NULL;
}
au_need_clean = TRUE;
@@ -5989,8 +5989,8 @@ static void au_cleanup(void)
* the command has been marked for deletion */
if (ap->pat == NULL || ac->cmd == NULL) {
*prev_ac = ac->next;
- vim_free(ac->cmd);
- vim_free(ac);
+ free(ac->cmd);
+ free(ac);
} else
prev_ac = &(ac->next);
}
@@ -5999,7 +5999,7 @@ static void au_cleanup(void)
if (ap->pat == NULL) {
*prev_ap = ap->next;
vim_regfree(ap->reg_prog);
- vim_free(ap);
+ free(ap);
} else
prev_ap = &(ap->next);
}
@@ -6077,7 +6077,7 @@ static void au_del_group(char_u *name)
if (i == AUGROUP_ERROR) /* the group doesn't exist */
EMSG2(_("E367: No such group: \"%s\""), name);
else {
- vim_free(AUGROUP_NAME(i));
+ free(AUGROUP_NAME(i));
AUGROUP_NAME(i) = NULL;
}
}
@@ -6274,7 +6274,7 @@ char_u *au_event_disable(char *what)
STRCAT(new_ei, what);
set_string_option_direct((char_u *)"ei", -1, new_ei,
OPT_FREE, SID_NONE);
- vim_free(new_ei);
+ free(new_ei);
}
}
return save_ei;
@@ -6285,7 +6285,7 @@ void au_event_restore(char_u *old_ei)
if (old_ei != NULL) {
set_string_option_direct((char_u *)"ei", -1, old_ei,
OPT_FREE, SID_NONE);
- vim_free(old_ei);
+ free(old_ei);
}
}
@@ -6419,8 +6419,8 @@ void do_autocmd(char_u *arg, int forceit)
}
if (need_free)
- vim_free(cmd);
- vim_free(envpat);
+ free(cmd);
+ free(envpat);
}
/*
@@ -6446,7 +6446,7 @@ static int au_get_grouparg(char_u **argp)
group = AUGROUP_ALL; /* no match, use all groups */
else
*argp = skipwhite(p); /* match, skip over group name */
- vim_free(group_name);
+ free(group_name);
}
return group;
}
@@ -6611,7 +6611,7 @@ static int do_autocmd_event(event_T event, char_u *pat, int nested, char_u *cmd,
ap->pat = vim_strnsave(pat, patlen);
ap->patlen = patlen;
if (ap->pat == NULL) {
- vim_free(ap);
+ free(ap);
return FAIL;
}
@@ -6626,10 +6626,10 @@ static int do_autocmd_event(event_T event, char_u *pat, int nested, char_u *cmd,
&ap->allow_dirs, TRUE);
if (reg_pat != NULL)
ap->reg_prog = vim_regcomp(reg_pat, RE_MAGIC);
- vim_free(reg_pat);
+ free(reg_pat);
if (reg_pat == NULL || ap->reg_prog == NULL) {
- vim_free(ap->pat);
- vim_free(ap);
+ free(ap->pat);
+ free(ap);
return FAIL;
}
}
@@ -6652,7 +6652,7 @@ static int do_autocmd_event(event_T event, char_u *pat, int nested, char_u *cmd,
ac->cmd = vim_strsave(cmd);
ac->scriptID = current_SID;
if (ac->cmd == NULL) {
- vim_free(ac);
+ free(ac);
return FAIL;
}
ac->next = NULL;
@@ -6833,7 +6833,7 @@ aucmd_prepbuf (
/* Make sure w_localdir and globaldir are NULL to avoid a chdir() in
* win_enter_ext(). */
- vim_free(aucmd_win->w_localdir);
+ free(aucmd_win->w_localdir);
aucmd_win->w_localdir = NULL;
aco->globaldir = globaldir;
globaldir = NULL;
@@ -6913,7 +6913,7 @@ win_found:
hash_init(&aucmd_win->w_vars->dv_hashtab); /* re-use the hashtab */
curbuf = curwin->w_buffer;
- vim_free(globaldir);
+ free(globaldir);
globaldir = aco->globaldir;
/* the buffer contents may have changed */
@@ -7242,7 +7242,7 @@ apply_autocmds_group (
fname = FullName_save(fname, FALSE);
}
if (fname == NULL) { /* out of memory */
- vim_free(sfname);
+ free(sfname);
retval = FALSE;
goto BYPASS_AU;
}
@@ -7348,10 +7348,10 @@ apply_autocmds_group (
autocmd_busy = save_autocmd_busy;
filechangeshell_busy = FALSE;
autocmd_nested = save_autocmd_nested;
- vim_free(sourcing_name);
+ free(sourcing_name);
sourcing_name = save_sourcing_name;
sourcing_lnum = save_sourcing_lnum;
- vim_free(autocmd_fname);
+ free(autocmd_fname);
autocmd_fname = save_autocmd_fname;
autocmd_fname_full = save_autocmd_fname_full;
autocmd_bufnr = save_autocmd_bufnr;
@@ -7360,8 +7360,8 @@ apply_autocmds_group (
restore_funccal(save_funccalp);
if (do_profiling == PROF_YES)
prof_child_exit(&wait_time);
- vim_free(fname);
- vim_free(sfname);
+ free(fname);
+ free(sfname);
--nesting; /* see matching increment above */
// When stopping to execute autocommands, restore the search patterns and
@@ -7372,7 +7372,7 @@ apply_autocmds_group (
did_filetype = FALSE;
while (au_pending_free_buf != NULL) {
buf_T *b = au_pending_free_buf->b_next;
- vim_free(au_pending_free_buf);
+ free(au_pending_free_buf);
au_pending_free_buf = b;
}
}
@@ -7443,7 +7443,7 @@ auto_next_pat (
char_u *name;
char *s;
- vim_free(sourcing_name);
+ free(sourcing_name);
sourcing_name = NULL;
for (ap = apc->curpat; ap != NULL && !got_int; ap = ap->next) {
@@ -7581,9 +7581,9 @@ int has_autocmd(event_T event, char_u *sfname, buf_T *buf)
break;
}
- vim_free(fname);
+ free(fname);
#ifdef BACKSLASH_IN_FILENAME
- vim_free(sfname);
+ free(sfname);
#endif
return retval;
@@ -7766,7 +7766,7 @@ int au_exists(char_u *arg)
}
theend:
- vim_free(arg_save);
+ free(arg_save);
return retval;
}
@@ -7888,7 +7888,7 @@ int match_file_list(char_u *list, char_u *sfname, char_u *ffname)
break;
match = match_file_pat(regpat, NULL, ffname, sfname,
tail, (int)allow_dirs);
- vim_free(regpat);
+ free(regpat);
if (match)
return TRUE;
}
@@ -8119,7 +8119,7 @@ file_pat_to_reg_pat (
EMSG(_("E219: Missing {."));
else
EMSG(_("E220: Missing }."));
- vim_free(reg_pat);
+ free(reg_pat);
reg_pat = NULL;
}
return reg_pat;
diff --git a/src/fold.c b/src/fold.c
index 38432a79aa..143b35ea10 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -1332,7 +1332,7 @@ static void deleteFoldEntry(garray_T *gap, int idx, int recursive)
sizeof(fold_T) * (gap->ga_len - (idx + 1)));
/* move the contained folds one level up */
memmove(fp, nfp, (size_t)(sizeof(fold_T) * moved));
- vim_free(nfp);
+ free(nfp);
gap->ga_len += moved - 1;
}
}
@@ -1774,7 +1774,7 @@ char_u *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume, foldinfo_T *foldi
}
if (*p != NUL) {
p = transstr(text);
- vim_free(text);
+ free(text);
text = p;
}
}
diff --git a/src/garray.c b/src/garray.c
index bb035935a8..e1046ceb5e 100644
--- a/src/garray.c
+++ b/src/garray.c
@@ -17,7 +17,7 @@
/// Clear an allocated growing array.
void ga_clear(garray_T *gap)
{
- vim_free(gap->ga_data);
+ free(gap->ga_data);
// Initialize growing array without resetting itemsize or growsize
gap->ga_data = NULL;
@@ -32,7 +32,7 @@ void ga_clear_strings(garray_T *gap)
{
int i;
for (i = 0; i < gap->ga_len; ++i) {
- vim_free(((char_u **)(gap->ga_data))[i]);
+ free(((char_u **)(gap->ga_data))[i]);
}
ga_clear(gap);
}
@@ -90,7 +90,7 @@ void ga_remove_duplicate_strings(garray_T *gap)
// loop over the growing array in reverse
for (int i = gap->ga_len - 1; i > 0; i--) {
if (fnamecmp(fnames[i - 1], fnames[i]) == 0) {
- vim_free(fnames[i]);
+ free(fnames[i]);
// close the gap (move all strings one slot lower)
for (int j = i + 1; j < gap->ga_len; j++) {
diff --git a/src/getchar.c b/src/getchar.c
index a27f5f0036..d6948ee671 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -174,7 +174,7 @@ void free_buff(buffheader_T *buf)
for (p = buf->bh_first.b_next; p != NULL; p = np) {
np = p->b_next;
- vim_free(p);
+ free(p);
}
buf->bh_first.b_next = NULL;
}
@@ -375,7 +375,7 @@ static int read_readbuf(buffheader_T *buf, int advance)
if (advance) {
if (curr->b_str[++buf->bh_index] == NUL) {
buf->bh_first.b_next = curr->b_next;
- vim_free(curr);
+ free(curr);
buf->bh_index = 0;
}
}
@@ -505,7 +505,7 @@ void saveRedobuff(void)
s = get_buffcont(&save_redobuff, FALSE);
if (s != NULL) {
add_buff(&redobuff, s, -1L);
- vim_free(s);
+ free(s);
}
}
}
@@ -898,7 +898,7 @@ int ins_typebuf(char_u *str, int noremap, int offset, int nottyped, int silent)
return FAIL;
s2 = alloc(newlen);
if (s2 == NULL) { /* out of memory */
- vim_free(s1);
+ free(s1);
return FAIL;
}
typebuf.tb_buflen = newlen;
@@ -914,7 +914,7 @@ int ins_typebuf(char_u *str, int noremap, int offset, int nottyped, int silent)
typebuf.tb_buf + typebuf.tb_off + offset,
(size_t)(typebuf.tb_len - offset + 1));
if (typebuf.tb_buf != typebuf_init)
- vim_free(typebuf.tb_buf);
+ free(typebuf.tb_buf);
typebuf.tb_buf = s1;
memmove(s2 + newoff, typebuf.tb_noremap + typebuf.tb_off,
@@ -923,7 +923,7 @@ int ins_typebuf(char_u *str, int noremap, int offset, int nottyped, int silent)
typebuf.tb_noremap + typebuf.tb_off + offset,
(size_t)(typebuf.tb_len - offset));
if (typebuf.tb_noremap != noremapbuf_init)
- vim_free(typebuf.tb_noremap);
+ free(typebuf.tb_noremap);
typebuf.tb_noremap = s2;
typebuf.tb_off = newoff;
@@ -1178,11 +1178,11 @@ void free_typebuf(void)
if (typebuf.tb_buf == typebuf_init)
EMSG2(_(e_intern2), "Free typebuf 1");
else
- vim_free(typebuf.tb_buf);
+ free(typebuf.tb_buf);
if (typebuf.tb_noremap == noremapbuf_init)
EMSG2(_(e_intern2), "Free typebuf 2");
else
- vim_free(typebuf.tb_noremap);
+ free(typebuf.tb_noremap);
}
/*
@@ -2134,10 +2134,10 @@ static int vgetorpeek(int advance)
i = ins_typebuf(s, noremap,
0, TRUE, cmd_silent || save_m_silent);
if (save_m_expr)
- vim_free(s);
+ free(s);
}
- vim_free(save_m_keys);
- vim_free(save_m_str);
+ free(save_m_keys);
+ free(save_m_str);
if (i == FAIL) {
c = -1;
break;
@@ -2986,9 +2986,9 @@ do_map (
retval = 4; /* no mem */
goto theend;
}
- vim_free(mp->m_str);
+ free(mp->m_str);
mp->m_str = newstr;
- vim_free(mp->m_orig_str);
+ free(mp->m_orig_str);
mp->m_orig_str = vim_strsave(orig_rhs);
mp->m_noremap = noremap;
mp->m_nowait = nowait;
@@ -3060,10 +3060,10 @@ do_map (
mp->m_str = vim_strsave(rhs);
mp->m_orig_str = vim_strsave(orig_rhs);
if (mp->m_keys == NULL || mp->m_str == NULL) {
- vim_free(mp->m_keys);
- vim_free(mp->m_str);
- vim_free(mp->m_orig_str);
- vim_free(mp);
+ free(mp->m_keys);
+ free(mp->m_str);
+ free(mp->m_orig_str);
+ free(mp);
retval = 4; /* no mem */
goto theend;
}
@@ -3086,8 +3086,8 @@ do_map (
}
theend:
- vim_free(keys_buf);
- vim_free(arg_buf);
+ free(keys_buf);
+ free(arg_buf);
return retval;
}
@@ -3100,11 +3100,11 @@ static void map_free(mapblock_T **mpp)
mapblock_T *mp;
mp = *mpp;
- vim_free(mp->m_keys);
- vim_free(mp->m_str);
- vim_free(mp->m_orig_str);
+ free(mp->m_keys);
+ free(mp->m_str);
+ free(mp->m_orig_str);
*mpp = mp->m_next;
- vim_free(mp);
+ free(mp);
}
/*
@@ -3297,7 +3297,7 @@ showmap (
if (mapchars != NULL) {
msg_puts(mapchars);
len = (int)STRLEN(mapchars);
- vim_free(mapchars);
+ free(mapchars);
}
while (++len <= 3)
@@ -3333,7 +3333,7 @@ showmap (
if (s != NULL) {
vim_unescape_csi(s);
msg_outtrans_special(s, FALSE);
- vim_free(s);
+ free(s);
}
}
if (p_verbose > 0)
@@ -3373,7 +3373,7 @@ int map_to_exists(char_u *str, char_u *modechars, int abbr)
mode |= CMDLINE;
retval = map_to_exists_mode(rhs, mode, abbr);
- vim_free(buf);
+ free(buf);
return retval;
}
@@ -3557,7 +3557,7 @@ int ExpandMappings(regmatch_T *regmatch, int *num_file, char_u ***file)
p = NULL;
}
}
- vim_free(p);
+ free(p);
}
} /* for (mp) */
} /* for (hash) */
@@ -3589,7 +3589,7 @@ int ExpandMappings(regmatch_T *regmatch, int *num_file, char_u ***file)
if (STRCMP(*ptr1, *ptr2))
*++ptr1 = *ptr2++;
else {
- vim_free(*ptr2++);
+ free(*ptr2++);
count--;
}
}
@@ -3744,7 +3744,7 @@ int check_abbr(int c, char_u *ptr, int col, int mincol)
/* no abbrev. for these chars */
typebuf.tb_no_abbr_cnt += (int)STRLEN(s) + j + 1;
if (mp->m_expr)
- vim_free(s);
+ free(s);
}
tb[0] = Ctrl_H;
@@ -3786,7 +3786,7 @@ eval_map_expr (
save_cmd = save_cmdline_alloc();
if (save_cmd == NULL) {
- vim_free(expr);
+ free(expr);
return NULL;
}
@@ -3806,13 +3806,13 @@ eval_map_expr (
msg_row = save_msg_row;
restore_cmdline_alloc(save_cmd);
- vim_free(expr);
+ free(expr);
if (p == NULL)
return NULL;
/* Escape CSI in the result to be able to use the string as typeahead. */
res = vim_strsave_escape_csi(p);
- vim_free(p);
+ free(p);
return res;
}
@@ -4329,7 +4329,7 @@ void add_map(char_u *map, int mode)
s = vim_strsave(map);
if (s != NULL) {
(void)do_map(0, s, mode, FALSE);
- vim_free(s);
+ free(s);
}
p_cpo = cpo_save;
}
diff --git a/src/hardcopy.c b/src/hardcopy.c
index 2e8939eece..1c334e76de 100644
--- a/src/hardcopy.c
+++ b/src/hardcopy.c
@@ -490,7 +490,7 @@ static void prt_header(prt_settings_T *psettings, int pagenum, linenr_T lnum)
p += l;
}
- vim_free(tbuf);
+ free(tbuf);
if (psettings->do_syntax)
/* Set colors for next character. */
@@ -1606,7 +1606,7 @@ static int prt_find_resource(char *name, struct prt_ps_resource_S *resource)
retval = (do_in_runtimepath(buffer, FALSE, prt_resource_name,
resource->filename)
&& resource->filename[0] != NUL);
- vim_free(buffer);
+ free(buffer);
return retval;
}
@@ -1998,7 +1998,7 @@ void mch_print_cleanup(void)
*/
for (i = PRT_PS_FONT_ROMAN; i <= PRT_PS_FONT_BOLDOBLIQUE; i++) {
if (prt_ps_mb_font.ps_fontname[i] != NULL)
- vim_free(prt_ps_mb_font.ps_fontname[i]);
+ free(prt_ps_mb_font.ps_fontname[i]);
prt_ps_mb_font.ps_fontname[i] = NULL;
}
}
@@ -2013,7 +2013,7 @@ void mch_print_cleanup(void)
prt_file_error = FALSE;
}
if (prt_ps_file_name != NULL) {
- vim_free(prt_ps_file_name);
+ free(prt_ps_file_name);
prt_ps_file_name = NULL;
}
}
@@ -2418,7 +2418,7 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
p = expand_env_save(psettings->outfile);
if (p != NULL) {
prt_ps_fd = mch_fopen((char *)p, WRITEBIN);
- vim_free(p);
+ free(p);
}
}
if (prt_ps_fd == NULL) {
@@ -2843,10 +2843,10 @@ int mch_print_begin(prt_settings_T *psettings)
/* Fail if any problems writing out to the PS file */
retval = !prt_file_error;
- vim_free(res_prolog);
- vim_free(res_encoding);
- vim_free(res_cidfont);
- vim_free(res_cmap);
+ free(res_prolog);
+ free(res_encoding);
+ free(res_cidfont);
+ free(res_cmap);
return retval;
}
@@ -3120,7 +3120,7 @@ int mch_print_text_out(char_u *p, int len)
/* Need to free any translated characters */
if (prt_do_conv && (*p != NUL))
- vim_free(p);
+ free(p);
prt_text_run += char_width;
prt_pos_x += char_width;
diff --git a/src/hashtab.c b/src/hashtab.c
index 1d3587b3ea..f8ec7453be 100644
--- a/src/hashtab.c
+++ b/src/hashtab.c
@@ -50,7 +50,7 @@ void hash_init(hashtab_T *ht)
void hash_clear(hashtab_T *ht)
{
if (ht->ht_array != ht->ht_smallarray) {
- vim_free(ht->ht_array);
+ free(ht->ht_array);
}
}
@@ -69,7 +69,7 @@ void hash_clear_all(hashtab_T *ht, int off)
for (hi = ht->ht_array; todo > 0; ++hi) {
if (!HASHITEM_EMPTY(hi)) {
- vim_free(hi->hi_key - off);
+ free(hi->hi_key - off);
todo--;
}
}
@@ -391,7 +391,7 @@ static int hash_may_resize(hashtab_T *ht, int minitems)
}
if (ht->ht_array != ht->ht_smallarray) {
- vim_free(ht->ht_array);
+ free(ht->ht_array);
}
ht->ht_array = newarray;
ht->ht_mask = newmask;
diff --git a/src/if_cscope.c b/src/if_cscope.c
index 2f283774fc..eadd1e5b1a 100644
--- a/src/if_cscope.c
+++ b/src/if_cscope.c
@@ -463,7 +463,7 @@ static void cs_stat_emsg(char *fname)
(void)sprintf(buf, stat_emsg, fname, errno);
(void)EMSG(buf);
- vim_free(buf);
+ free(buf);
}
@@ -502,7 +502,7 @@ cs_add_common (
if (fname == NULL)
goto add_err;
fname = (char *)vim_strnsave((char_u *)fname, len);
- vim_free(fbuf);
+ free(fbuf);
ret = stat(fname, &statbuf);
if (ret < 0) {
staterr:
@@ -578,15 +578,15 @@ staterr:
}
}
- vim_free(fname);
- vim_free(fname2);
- vim_free(ppath);
+ free(fname);
+ free(fname2);
+ free(ppath);
return CSCOPE_SUCCESS;
add_err:
- vim_free(fname2);
- vim_free(fname);
- vim_free(ppath);
+ free(fname2);
+ free(fname);
+ free(ppath);
return CSCOPE_FAILURE;
} /* cs_add_common */
@@ -646,7 +646,7 @@ static int cs_cnt_matches(int idx)
cs_reading_emsg(idx);
- vim_free(buf);
+ free(buf);
return -1;
}
@@ -677,7 +677,7 @@ static int cs_cnt_matches(int idx)
break;
}
- vim_free(buf);
+ free(buf);
return nlines;
} /* cs_cnt_matches */
@@ -846,9 +846,9 @@ err_closing:
}
# ifdef UNIX
/* on Win32 we still need prog */
- vim_free(prog);
+ free(prog);
# endif
- vim_free(ppath);
+ free(ppath);
#if defined(UNIX)
# if defined(HAVE_SETSID) || defined(HAVE_SETPGID)
@@ -893,8 +893,8 @@ err_closing:
si.hStdInput = stdin_rd;
created = CreateProcess(NULL, cmd, NULL, NULL, TRUE, CREATE_NEW_CONSOLE,
NULL, NULL, &si, &pi);
- vim_free(prog);
- vim_free(cmd);
+ free(prog);
+ free(cmd);
if (!created) {
PERROR(_("cs_create_connection exec failed"));
@@ -1023,7 +1023,7 @@ static int cs_find_common(char *opt, char *pat, int forceit, int verbose, int us
sprintf(buf, nf, *qfpos, *(qfpos-1));
(void)EMSG(buf);
- vim_free(buf);
+ free(buf);
return FALSE;
}
@@ -1063,22 +1063,22 @@ static int cs_find_common(char *opt, char *pat, int forceit, int verbose, int us
if (nummatches[i] == 0)
(void)cs_read_prompt(i);
}
- vim_free(cmd);
+ free(cmd);
if (totmatches == 0) {
char *nf = _("E259: no matches found for cscope query %s of %s");
char *buf;
if (!verbose) {
- vim_free(nummatches);
+ free(nummatches);
return FALSE;
}
buf = (char *)alloc((unsigned)(strlen(opt) + strlen(pat) + strlen(nf)));
sprintf(buf, nf, opt, pat);
(void)EMSG(buf);
- vim_free(buf);
- vim_free(nummatches);
+ free(buf);
+ free(nummatches);
return FALSE;
}
@@ -1120,8 +1120,8 @@ static int cs_find_common(char *opt, char *pat, int forceit, int verbose, int us
}
}
os_remove((char *)tmp);
- vim_free(tmp);
- vim_free(nummatches);
+ free(tmp);
+ free(nummatches);
return TRUE;
} else {
char **matches = NULL, **contexts = NULL;
@@ -1130,7 +1130,7 @@ static int cs_find_common(char *opt, char *pat, int forceit, int verbose, int us
/* read output */
cs_fill_results((char *)pat, totmatches, nummatches, &matches,
&contexts, &matched);
- vim_free(nummatches);
+ free(nummatches);
if (matches == NULL)
return FALSE;
@@ -1522,12 +1522,12 @@ static char *cs_manage_matches(char **matches, char **contexts, int totmatches,
if (mp != NULL) {
if (cnt > 0)
while (cnt--) {
- vim_free(mp[cnt]);
+ free(mp[cnt]);
if (cp != NULL)
- vim_free(cp[cnt]);
+ free(cp[cnt]);
}
- vim_free(mp);
- vim_free(cp);
+ free(mp);
+ free(cp);
}
mp = NULL;
cp = NULL;
@@ -1636,14 +1636,14 @@ static void cs_file_results(FILE *f, int *nummatches_a)
else
fprintf(f, "%s\t%s\t%s %s\n", fullname, slno, context, search);
- vim_free(context);
- vim_free(fullname);
+ free(context);
+ free(fullname);
} /* for all matches */
(void)cs_read_prompt(i);
} /* for all cscope connections */
- vim_free(buf);
+ free(buf);
}
/*
@@ -1682,7 +1682,7 @@ static void cs_fill_results(char *tagstr, int totmatches, int *nummatches_a, cha
matches[totsofar] = cs_make_vim_style_matches(fullname, slno, search,
tagstr);
- vim_free(fullname);
+ free(fullname);
if (strcmp(cntx, "<global>") == 0)
cntxts[totsofar] = NULL;
@@ -1703,16 +1703,16 @@ static void cs_fill_results(char *tagstr, int totmatches, int *nummatches_a, cha
if (totsofar == 0) {
/* No matches, free the arrays and return NULL in "*matches_p". */
- vim_free(matches);
+ free(matches);
matches = NULL;
- vim_free(cntxts);
+ free(cntxts);
cntxts = NULL;
}
*matched = totsofar;
*matches_p = matches;
*cntxts_p = cntxts;
- vim_free(buf);
+ free(buf);
} /* cs_fill_results */
@@ -1768,7 +1768,7 @@ static void cs_print_tags_priv(char **matches, char **cntxts, int num_matches)
(void)sprintf(buf, cstag_msg, ptag);
MSG_PUTS_ATTR(buf, hl_attr(HLF_T));
- vim_free(tbuf);
+ free(tbuf);
MSG_PUTS_ATTR(_("\n # line"), hl_attr(HLF_T)); /* strlen is 7 */
msg_advance(msg_col + 2);
@@ -1834,7 +1834,7 @@ static void cs_print_tags_priv(char **matches, char **cntxts, int num_matches)
MSG_PUTS_LONG(extra);
}
- vim_free(tbuf); /* only after printing extra due to strtok use */
+ free(tbuf); /* only after printing extra due to strtok use */
if (msg_col)
msg_putchar('\n');
@@ -1848,7 +1848,7 @@ static void cs_print_tags_priv(char **matches, char **cntxts, int num_matches)
num++;
} /* for all matches */
- vim_free(buf);
+ free(buf);
} /* cs_print_tags_priv */
@@ -1911,7 +1911,7 @@ static int cs_read_prompt(int i)
else if (p_csverbose)
cs_reading_emsg(i); /* don't have additional information */
cs_release_csp(i, TRUE);
- vim_free(buf);
+ free(buf);
return CSCOPE_FAILURE;
}
@@ -1926,7 +1926,7 @@ static int cs_read_prompt(int i)
break; /* did find the prompt */
}
- vim_free(buf);
+ free(buf);
return CSCOPE_SUCCESS;
}
@@ -2052,9 +2052,9 @@ static void cs_release_csp(int i, int freefnpp)
(void)fclose(csinfo[i].to_fp);
if (freefnpp) {
- vim_free(csinfo[i].fname);
- vim_free(csinfo[i].ppath);
- vim_free(csinfo[i].flags);
+ free(csinfo[i].fname);
+ free(csinfo[i].ppath);
+ free(csinfo[i].flags);
}
clear_csinfo(i);
@@ -2101,13 +2101,13 @@ static int cs_reset(exarg_T *eap)
MSG_PUTS_ATTR(buf, hl_attr(HLF_R));
}
}
- vim_free(dblist[i]);
- vim_free(pplist[i]);
- vim_free(fllist[i]);
+ free(dblist[i]);
+ free(pplist[i]);
+ free(fllist[i]);
}
- vim_free(dblist);
- vim_free(pplist);
- vim_free(fllist);
+ free(dblist);
+ free(pplist);
+ free(fllist);
if (p_csverbose)
MSG_ATTR(_("All cscope databases reset"), hl_attr(HLF_R) | MSG_HIST);
@@ -2167,7 +2167,7 @@ static char *cs_resolve_file(int i, char *name)
fullname = (char *)vim_strsave((char_u *)name);
}
- vim_free(csdir);
+ free(csdir);
return fullname;
}
@@ -2215,7 +2215,7 @@ void cs_end(void)
for (i = 0; i < csinfo_size; i++)
cs_release_csp(i, TRUE);
- vim_free(csinfo);
+ free(csinfo);
csinfo_size = 0;
}
diff --git a/src/indent.c b/src/indent.c
index 10530b71f8..61fe5ab251 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -277,7 +277,7 @@ int set_indent(int size, int flags)
}
retval = true;
} else {
- vim_free(newline);
+ free(newline);
}
curwin->w_cursor.col = ind_len;
return retval;
diff --git a/src/indent_c.c b/src/indent_c.c
index 08b28c73f2..77ca3a34cb 100644
--- a/src/indent_c.c
+++ b/src/indent_c.c
@@ -131,7 +131,7 @@ int cin_is_cinword(char_u *line)
break;
}
}
- vim_free(cinw_buf);
+ free(cinw_buf);
return retval;
}
@@ -3195,7 +3195,7 @@ theend:
/* put the cursor back where it belongs */
curwin->w_cursor = cur_curpos;
- vim_free(linecopy);
+ free(linecopy);
if (amount < 0)
return 0;
diff --git a/src/main.c b/src/main.c
index 105f676bbd..acbe67ebc1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -705,7 +705,7 @@ main_loop (
p = keep_msg;
keep_msg = NULL;
msg_attr(p, keep_msg_attr);
- vim_free(p);
+ free(p);
}
if (need_fileinfo) { /* show file info after redraw */
fileinfo(FALSE, TRUE, FALSE);
@@ -904,7 +904,7 @@ static void init_locale(void)
bindtextdomain(VIMPACKAGE, (char *)NameBuff);
}
if (mustfree)
- vim_free(p);
+ free(p);
textdomain(VIMPACKAGE);
}
TIME_MSG("locale set");
@@ -1432,7 +1432,7 @@ scripterror:
char_u *r;
r = concat_fnames(p, path_tail(alist_name(&GARGLIST[0])), TRUE);
- vim_free(p);
+ free(p);
p = r;
}
@@ -1469,7 +1469,7 @@ scripterror:
p = alloc((unsigned)STRLEN(parmp->commands[0]) + 3);
sprintf((char *)p, ":%s\r", parmp->commands[0]);
set_vim_var_string(VV_SWAPCOMMAND, p, -1);
- vim_free(p);
+ free(p);
}
TIME_MSG("parsing arguments");
}
@@ -1929,7 +1929,7 @@ static void exe_commands(mparm_T *parmp)
for (i = 0; i < parmp->n_commands; ++i) {
do_cmdline_cmd(parmp->commands[i]);
if (parmp->cmds_tofree[i])
- vim_free(parmp->commands[i]);
+ free(parmp->commands[i]);
}
sourcing_name = NULL;
current_SID = 0;
diff --git a/src/mark.c b/src/mark.c
index bd37f93eb1..5aa1212c0d 100644
--- a/src/mark.c
+++ b/src/mark.c
@@ -128,7 +128,7 @@ int setmark_pos(int c, pos_T *pos, int fnum)
i = c - 'A';
namedfm[i].fmark.mark = *pos;
namedfm[i].fmark.fnum = fnum;
- vim_free(namedfm[i].fname);
+ free(namedfm[i].fname);
namedfm[i].fname = NULL;
return OK;
}
@@ -174,7 +174,7 @@ void setpcmark(void)
/* If jumplist is full: remove oldest entry */
if (++curwin->w_jumplistlen > JUMPLISTSIZE) {
curwin->w_jumplistlen = JUMPLISTSIZE;
- vim_free(curwin->w_jumplist[0].fname);
+ free(curwin->w_jumplist[0].fname);
for (i = 1; i < JUMPLISTSIZE; ++i)
curwin->w_jumplist[i - 1] = curwin->w_jumplist[i];
}
@@ -516,7 +516,7 @@ void fmarks_check_names(buf_T *buf)
fmarks_check_one(&wp->w_jumplist[i], name, buf);
}
- vim_free(name);
+ free(name);
}
static void fmarks_check_one(xfmark_T *fm, char_u *name, buf_T *buf)
@@ -525,7 +525,7 @@ static void fmarks_check_one(xfmark_T *fm, char_u *name, buf_T *buf)
&& fm->fname != NULL
&& fnamecmp(name, fm->fname) == 0) {
fm->fmark.fnum = buf->b_fnum;
- vim_free(fm->fname);
+ free(fm->fname);
fm->fname = NULL;
}
}
@@ -643,7 +643,7 @@ void do_marks(exarg_T *eap)
arg, &namedfm[i].fmark.mark, name,
namedfm[i].fmark.fnum == curbuf->b_fnum);
if (namedfm[i].fmark.fnum != 0)
- vim_free(name);
+ free(name);
}
}
show_one_mark('"', arg, &curbuf->b_last_cursor, NULL, TRUE);
@@ -698,7 +698,7 @@ show_one_mark (
if (name != NULL) {
msg_outtrans_attr(name, current ? hl_attr(HLF_D) : 0);
if (mustfree)
- vim_free(name);
+ free(name);
}
}
out_flush(); /* show one line at a time */
@@ -755,7 +755,7 @@ void ex_delmarks(exarg_T *eap)
else
n = i - 'A';
namedfm[n].fmark.mark.lnum = 0;
- vim_free(namedfm[n].fname);
+ free(namedfm[n].fname);
namedfm[n].fname = NULL;
}
}
@@ -797,7 +797,7 @@ void ex_jumps(exarg_T *eap)
msg_putchar('\n');
if (got_int) {
- vim_free(name);
+ free(name);
break;
}
sprintf((char *)IObuff, "%c %2d %5ld %4d ",
@@ -810,7 +810,7 @@ void ex_jumps(exarg_T *eap)
msg_outtrans_attr(name,
curwin->w_jumplist[i].fmark.fnum == curbuf->b_fnum
? hl_attr(HLF_D) : 0);
- vim_free(name);
+ free(name);
ui_breakcheck();
}
out_flush();
@@ -846,7 +846,7 @@ void ex_changes(exarg_T *eap)
if (name == NULL)
break;
msg_outtrans_attr(name, hl_attr(HLF_D));
- vim_free(name);
+ free(name);
ui_breakcheck();
}
out_flush();
@@ -1129,7 +1129,7 @@ static void cleanup_jumplist(void)
if (i >= curwin->w_jumplistlen) /* no duplicate */
curwin->w_jumplist[to++] = curwin->w_jumplist[from];
else
- vim_free(curwin->w_jumplist[from].fname);
+ free(curwin->w_jumplist[from].fname);
}
if (curwin->w_jumplistidx == curwin->w_jumplistlen)
curwin->w_jumplistidx = to;
@@ -1160,7 +1160,7 @@ void free_jumplist(win_T *wp)
int i;
for (i = 0; i < wp->w_jumplistlen; ++i)
- vim_free(wp->w_jumplist[i].fname);
+ free(wp->w_jumplist[i].fname);
}
void set_last_cursor(win_T *win)
@@ -1176,7 +1176,7 @@ void free_all_marks(void)
for (i = 0; i < NMARKS + EXTRA_MARKS; i++)
if (namedfm[i].fmark.mark.lnum != 0)
- vim_free(namedfm[i].fname);
+ free(namedfm[i].fname);
}
#endif
@@ -1219,7 +1219,7 @@ int read_viminfo_filemark(vir_T *virp, int force)
fm->fmark.mark.coladd = 0;
fm->fmark.fnum = 0;
str = skipwhite(str);
- vim_free(fm->fname);
+ free(fm->fname);
fm->fname = viminfo_readstring(virp, (int)(str - virp->vir_line),
FALSE);
}
@@ -1254,9 +1254,9 @@ void write_viminfo_filemarks(FILE *fp)
: (name != NULL
&& STRCMP(name, namedfm[i].fname) == 0)))
break;
- vim_free(name);
+ free(name);
- vim_free(namedfm[i].fname);
+ free(namedfm[i].fname);
for (; i > NMARKS; --i)
namedfm[i] = namedfm[i - 1];
namedfm[NMARKS].fmark.mark = curwin->w_cursor;
@@ -1300,7 +1300,7 @@ static void write_one_filemark(FILE *fp, xfmark_T *fm, int c1, int c2)
}
if (fm->fmark.fnum != 0)
- vim_free(name);
+ free(name);
}
/*
@@ -1325,7 +1325,7 @@ int removable(char_u *name)
}
}
}
- vim_free(name);
+ free(name);
}
return retval;
}
@@ -1487,7 +1487,7 @@ void copy_viminfo_marks(vir_T *virp, FILE *fp_out, int count, int eof, int flags
count++;
}
}
- vim_free(str);
+ free(str);
pos.coladd = 0;
while (!(eof = viminfo_readline(virp)) && line[0] == TAB) {
@@ -1535,5 +1535,5 @@ void copy_viminfo_marks(vir_T *virp, FILE *fp_out, int count, int eof, int flags
break;
}
}
- vim_free(name_buf);
+ free(name_buf);
}
diff --git a/src/mbyte.c b/src/mbyte.c
index f150b9b9ca..09cb1ce35b 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -513,7 +513,7 @@ char_u * mb_init()
convert_setup(&vimconv, p_enc, (char_u *)"utf-8");
vimconv.vc_fail = TRUE;
}
- vim_free(p);
+ free(p);
}
#endif
@@ -539,7 +539,7 @@ char_u * mb_init()
*/
p = string_convert(&vimconv, (char_u *)buf, NULL);
if (p != NULL) {
- vim_free(p);
+ free(p);
n = 1;
} else
n = 2;
@@ -3097,7 +3097,7 @@ void utf_find_illegal()
for (;; ) {
p = ml_get_cursor();
if (vimconv.vc_type != CONV_NONE) {
- vim_free(tofree);
+ free(tofree);
tofree = string_convert(&vimconv, p, NULL);
if (tofree == NULL)
break;
@@ -3136,7 +3136,7 @@ void utf_find_illegal()
beep_flush();
theend:
- vim_free(tofree);
+ free(tofree);
convert_setup(&vimconv, NULL, NULL);
}
@@ -3372,7 +3372,7 @@ char_u * enc_canonize(char_u *enc)
STRMOVE(r, p);
} else if ((i = enc_alias_search(p)) >= 0) {
/* alias recognized, get canonical name */
- vim_free(r);
+ free(r);
r = vim_strsave((char_u *)enc_canon_table[i].name);
}
return r;
@@ -3536,7 +3536,7 @@ static char_u * iconv_string(vimconv_T *vcp, char_u *str, int slen, int *unconvl
p = alloc((unsigned)len);
if (done > 0)
memmove(p, result, done);
- vim_free(result);
+ free(result);
result = p;
if (result == NULL) /* out of memory */
break;
@@ -3584,7 +3584,7 @@ static char_u * iconv_string(vimconv_T *vcp, char_u *str, int slen, int *unconvl
fromlen -= l;
} else if (ICONV_ERRNO != ICONV_E2BIG) {
/* conversion failed */
- vim_free(result);
+ free(result);
result = NULL;
break;
}
@@ -3860,7 +3860,7 @@ int convert_input_safe(ptr, len, maxlen, restp, restlenp)
/* result is too long, keep the unconverted text (the caller must
* have done something wrong!) */
dlen = len;
- vim_free(d);
+ free(d);
}
return dlen;
}
@@ -3958,7 +3958,7 @@ char_u * string_convert_ext(vcp, ptr, lenp, unconvlenp)
if (l_w == 0) {
/* Illegal utf-8 byte cannot be converted */
- vim_free(retval);
+ free(retval);
return NULL;
}
if (unconvlenp != NULL && l_w > len - i) {
@@ -3992,7 +3992,7 @@ char_u * string_convert_ext(vcp, ptr, lenp, unconvlenp)
if (c < 0x100)
*d++ = c;
else if (vcp->vc_fail) {
- vim_free(retval);
+ free(retval);
return NULL;
} else {
*d++ = 0xbf;
diff --git a/src/memfile.c b/src/memfile.c
index 9f8d482768..5330fb7fc5 100644
--- a/src/memfile.c
+++ b/src/memfile.c
@@ -142,7 +142,7 @@ memfile_T *mf_open(char_u *fname, int flags)
/* if the file cannot be opened, return here */
if (mfp->mf_fd < 0) {
- vim_free(mfp);
+ free(mfp);
return NULL;
}
}
@@ -246,12 +246,12 @@ void mf_close(memfile_T *mfp, int del_file)
mf_free_bhdr(hp);
}
while (mfp->mf_free_first != NULL) /* free entries in free list */
- vim_free(mf_rem_free(mfp));
+ free(mf_rem_free(mfp));
mf_hash_free(&mfp->mf_hash);
mf_hash_free_all(&mfp->mf_trans); /* free hashtable and its items */
- vim_free(mfp->mf_fname);
- vim_free(mfp->mf_ffname);
- vim_free(mfp);
+ free(mfp->mf_fname);
+ free(mfp->mf_ffname);
+ free(mfp);
}
/*
@@ -285,8 +285,8 @@ mf_close_file (
if (mfp->mf_fname != NULL) {
os_remove((char *)mfp->mf_fname); // delete the swap file
- vim_free(mfp->mf_fname);
- vim_free(mfp->mf_ffname);
+ free(mfp->mf_fname);
+ free(mfp->mf_ffname);
mfp->mf_fname = NULL;
mfp->mf_ffname = NULL;
}
@@ -353,7 +353,7 @@ bhdr_T *mf_new(memfile_T *mfp, int negative, int page_count)
} else { /* use the number, remove entry from free list */
freep = mf_rem_free(mfp);
hp->bh_bnum = freep->bh_bnum;
- vim_free(freep);
+ free(freep);
}
} else { /* get a new number */
if (hp == NULL && (hp = mf_alloc_bhdr(mfp, page_count)) == NULL)
@@ -463,11 +463,11 @@ void mf_put(memfile_T *mfp, bhdr_T *hp, int dirty, int infile)
*/
void mf_free(memfile_T *mfp, bhdr_T *hp)
{
- vim_free(hp->bh_data); /* free the memory */
+ free(hp->bh_data); /* free the memory */
mf_rem_hash(mfp, hp); /* get *hp out of the hash list */
mf_rem_used(mfp, hp); /* get *hp out of the used list */
if (hp->bh_bnum < 0) {
- vim_free(hp); /* don't want negative numbers in free list */
+ free(hp); /* don't want negative numbers in free list */
mfp->mf_neg_count--;
} else
mf_ins_free(mfp, hp); /* put *hp in the free list */
@@ -712,9 +712,9 @@ static bhdr_T *mf_release(memfile_T *mfp, int page_count)
* right
*/
if (hp->bh_page_count != page_count) {
- vim_free(hp->bh_data);
+ free(hp->bh_data);
if ((hp->bh_data = alloc(mfp->mf_page_size * page_count)) == NULL) {
- vim_free(hp);
+ free(hp);
return NULL;
}
hp->bh_page_count = page_count;
@@ -772,7 +772,7 @@ static bhdr_T *mf_alloc_bhdr(memfile_T *mfp, int page_count)
if ((hp = (bhdr_T *)alloc((unsigned)sizeof(bhdr_T))) != NULL) {
if ((hp->bh_data = (char_u *)alloc(mfp->mf_page_size * page_count))
== NULL) {
- vim_free(hp); /* not enough memory */
+ free(hp); /* not enough memory */
return NULL;
}
hp->bh_page_count = page_count;
@@ -785,8 +785,8 @@ static bhdr_T *mf_alloc_bhdr(memfile_T *mfp, int page_count)
*/
static void mf_free_bhdr(bhdr_T *hp)
{
- vim_free(hp->bh_data);
- vim_free(hp);
+ free(hp->bh_data);
+ free(hp);
}
/*
@@ -934,7 +934,7 @@ static int mf_write_block(memfile_T *mfp, bhdr_T *hp, off_t offset, unsigned siz
result = FAIL;
if (data != hp->bh_data)
- vim_free(data);
+ free(data);
return result;
}
@@ -975,7 +975,7 @@ static int mf_trans_add(memfile_T *mfp, bhdr_T *hp)
freep->bh_page_count -= page_count;
} else {
freep = mf_rem_free(mfp);
- vim_free(freep);
+ free(freep);
}
} else {
new_bnum = mfp->mf_blocknr_max;
@@ -1016,7 +1016,7 @@ blocknr_T mf_trans_del(memfile_T *mfp, blocknr_T old_nr)
/* remove entry from the trans list */
mf_hash_rem_item(&mfp->mf_trans, (mf_hashitem_T *)np);
- vim_free(np);
+ free(np);
return new_bnum;
}
@@ -1038,7 +1038,7 @@ void mf_set_ffname(memfile_T *mfp)
void mf_fullname(memfile_T *mfp)
{
if (mfp != NULL && mfp->mf_fname != NULL && mfp->mf_ffname != NULL) {
- vim_free(mfp->mf_fname);
+ free(mfp->mf_fname);
mfp->mf_fname = mfp->mf_ffname;
mfp->mf_ffname = NULL;
}
@@ -1099,8 +1099,8 @@ mf_do_open (
* If the file cannot be opened, use memory only
*/
if (mfp->mf_fd < 0) {
- vim_free(mfp->mf_fname);
- vim_free(mfp->mf_ffname);
+ free(mfp->mf_fname);
+ free(mfp->mf_ffname);
mfp->mf_fname = NULL;
mfp->mf_ffname = NULL;
} else {
@@ -1145,7 +1145,7 @@ static void mf_hash_init(mf_hashtab_T *mht)
static void mf_hash_free(mf_hashtab_T *mht)
{
if (mht->mht_buckets != mht->mht_small_buckets)
- vim_free(mht->mht_buckets);
+ free(mht->mht_buckets);
}
/*
@@ -1160,7 +1160,7 @@ static void mf_hash_free_all(mf_hashtab_T *mht)
for (idx = 0; idx <= mht->mht_mask; idx++)
for (mhi = mht->mht_buckets[idx]; mhi != NULL; mhi = next) {
next = mhi->mhi_next;
- vim_free(mhi);
+ free(mhi);
}
mf_hash_free(mht);
@@ -1281,7 +1281,7 @@ static void mf_hash_grow(mf_hashtab_T *mht)
}
if (mht->mht_buckets != mht->mht_small_buckets)
- vim_free(mht->mht_buckets);
+ free(mht->mht_buckets);
mht->mht_buckets = buckets;
mht->mht_mask = (mht->mht_mask + 1) * MHT_GROWTH_FACTOR - 1;
diff --git a/src/memline.c b/src/memline.c
index 90f286367a..53864e6b5d 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -480,7 +480,7 @@ void ml_set_crypt_key(buf_T *buf, char_u *old_key, int old_cm)
idx = 0; /* start with first index in block 1 */
error = 0;
buf->b_ml.ml_stack_top = 0;
- vim_free(buf->b_ml.ml_stack);
+ free(buf->b_ml.ml_stack);
buf->b_ml.ml_stack = NULL;
buf->b_ml.ml_stack_size = 0; /* no stack yet */
@@ -585,7 +585,7 @@ void ml_setname(buf_T *buf)
/* if the file name is the same we don't have to do anything */
if (fnamecmp(fname, mfp->mf_fname) == 0) {
- vim_free(fname);
+ free(fname);
success = TRUE;
break;
}
@@ -598,14 +598,14 @@ void ml_setname(buf_T *buf)
/* try to rename the swap file */
if (vim_rename(mfp->mf_fname, fname) == 0) {
success = TRUE;
- vim_free(mfp->mf_fname);
+ free(mfp->mf_fname);
mfp->mf_fname = fname;
- vim_free(mfp->mf_ffname);
+ free(mfp->mf_ffname);
mf_set_ffname(mfp);
ml_upd_block0(buf, UB_SAME_DIR);
break;
}
- vim_free(fname); /* this fname didn't work, try another */
+ free(fname); /* this fname didn't work, try another */
}
if (mfp->mf_fd == -1) { /* need to (re)open the swap file */
@@ -733,9 +733,9 @@ void ml_close(buf_T *buf, int del_file)
return;
mf_close(buf->b_ml.ml_mfp, del_file); /* close the .swp file */
if (buf->b_ml.ml_line_lnum != 0 && (buf->b_ml.ml_flags & ML_LINE_DIRTY))
- vim_free(buf->b_ml.ml_line_ptr);
- vim_free(buf->b_ml.ml_stack);
- vim_free(buf->b_ml.ml_chunksize);
+ free(buf->b_ml.ml_line_ptr);
+ free(buf->b_ml.ml_stack);
+ free(buf->b_ml.ml_chunksize);
buf->b_ml.ml_chunksize = NULL;
buf->b_ml.ml_mfp = NULL;
@@ -1128,7 +1128,7 @@ void ml_recover(void)
/* need to reallocate the memory used to store the data */
p = alloc(mfp->mf_page_size);
memmove(p, hp->bh_data, previous_page_size);
- vim_free(hp->bh_data);
+ free(hp->bh_data);
hp->bh_data = p;
b0p = (ZERO_BL *)(hp->bh_data);
}
@@ -1214,7 +1214,7 @@ void ml_recover(void)
if (buf->b_p_key == NULL)
buf->b_p_key = curbuf->b_p_key;
else if (*buf->b_p_key == NUL) {
- vim_free(buf->b_p_key);
+ free(buf->b_p_key);
buf->b_p_key = curbuf->b_p_key;
}
if (buf->b_p_key == NULL)
@@ -1226,7 +1226,7 @@ void ml_recover(void)
set_fileformat(b0_ff - 1, OPT_LOCAL);
if (b0_fenc != NULL) {
set_option_value((char_u *)"fenc", 0L, b0_fenc, OPT_LOCAL);
- vim_free(b0_fenc);
+ free(b0_fenc);
}
unchanged(curbuf, TRUE);
@@ -1412,7 +1412,7 @@ void ml_recover(void)
/* Need to copy one line, fetching the other one may flush it. */
p = vim_strsave(ml_get(idx));
i = STRCMP(p, ml_get(idx + lnum));
- vim_free(p);
+ free(p);
if (i != 0) {
changed_int();
++curbuf->b_changedtick;
@@ -1459,19 +1459,19 @@ void ml_recover(void)
redraw_curbuf_later(NOT_VALID);
theend:
- vim_free(fname_used);
+ free(fname_used);
recoverymode = FALSE;
if (mfp != NULL) {
if (hp != NULL)
mf_put(mfp, hp, FALSE, FALSE);
- mf_close(mfp, FALSE); /* will also vim_free(mfp->mf_fname) */
+ mf_close(mfp, FALSE); /* will also free(mfp->mf_fname) */
}
if (buf != NULL) {
if (buf->b_p_key != curbuf->b_p_key)
free_string_option(buf->b_p_key);
free_string_option(buf->b_p_cm);
- vim_free(buf->b_ml.ml_stack);
- vim_free(buf);
+ free(buf->b_ml.ml_stack);
+ free(buf);
}
if (serious_error && called_from_main)
ml_close(curbuf, TRUE);
@@ -1583,7 +1583,7 @@ recover_names (
tail = path_tail(fname_res);
tail = concat_fnames(dir_name, tail, TRUE);
num_names = recov_file_names(names, tail, FALSE);
- vim_free(tail);
+ free(tail);
}
}
@@ -1591,7 +1591,7 @@ recover_names (
for (i = 0; i < num_names; ++i) {
if (names[i] == NULL) {
for (i = 0; i < num_names; ++i)
- vim_free(names[i]);
+ free(names[i]);
num_names = 0;
}
}
@@ -1618,7 +1618,7 @@ recover_names (
swapname = NULL;
num_files = 1;
}
- vim_free(swapname);
+ free(swapname);
}
}
@@ -1632,9 +1632,9 @@ recover_names (
/* Remove the name from files[i]. Move further entries
* down. When the array becomes empty free it here, since
* FreeWild() won't be called below. */
- vim_free(files[i]);
+ free(files[i]);
if (--num_files == 0)
- vim_free(files);
+ free(files);
else
for (; i < num_files; ++i)
files[i] = files[i + 1];
@@ -1675,11 +1675,11 @@ recover_names (
file_count += num_files;
for (i = 0; i < num_names; ++i)
- vim_free(names[i]);
+ free(names[i]);
if (num_files > 0)
FreeWild(num_files, files);
}
- vim_free(dir_name);
+ free(dir_name);
return file_count;
}
@@ -1700,8 +1700,8 @@ static char_u *make_percent_swname(char_u *dir, char_u *name)
if (vim_ispathsep(*d))
*d = '%';
d = concat_fnames(dir, s, TRUE);
- vim_free(s);
- vim_free(f);
+ free(s);
+ free(f);
}
return d;
}
@@ -1833,7 +1833,7 @@ static int recov_file_names(char_u **names, char_u *path, int prepend_dot)
if (STRCMP(p, names[num_names]) != 0)
++num_names;
else
- vim_free(names[num_names]);
+ free(names[num_names]);
} else
++num_names;
@@ -2613,7 +2613,7 @@ int ml_replace(linenr_T lnum, char_u *line, int copy)
if (curbuf->b_ml.ml_line_lnum != lnum) /* other line buffered */
ml_flush_line(curbuf); /* flush it */
else if (curbuf->b_ml.ml_flags & ML_LINE_DIRTY) /* same line allocated */
- vim_free(curbuf->b_ml.ml_line_ptr); /* free it */
+ free(curbuf->b_ml.ml_line_ptr); /* free it */
curbuf->b_ml.ml_line_ptr = line;
curbuf->b_ml.ml_line_lnum = lnum;
curbuf->b_ml.ml_flags = (curbuf->b_ml.ml_flags | ML_LINE_DIRTY) & ~ML_EMPTY;
@@ -2969,7 +2969,7 @@ static void ml_flush_line(buf_T *buf)
(void)ml_delete_int(buf, lnum, FALSE);
}
}
- vim_free(new_line);
+ free(new_line);
entered = FALSE;
}
@@ -3222,7 +3222,7 @@ static int ml_add_stack(buf_T *buf)
infoptr_T *newstack = xmalloc(sizeof(infoptr_T) *
(buf->b_ml.ml_stack_size + STACK_INCR));
memmove(newstack, buf->b_ml.ml_stack, (size_t)top * sizeof(infoptr_T));
- vim_free(buf->b_ml.ml_stack);
+ free(buf->b_ml.ml_stack);
buf->b_ml.ml_stack = newstack;
buf->b_ml.ml_stack_size += STACK_INCR;
}
@@ -3355,7 +3355,7 @@ char_u *makeswapname(char_u *fname, char_u *ffname, buf_T *buf, char_u *dir_name
r = NULL;
if ((s = make_percent_swname(dir_name, fname)) != NULL) {
r = modname(s, (char_u *)".swp", FALSE);
- vim_free(s);
+ free(s);
}
return r;
}
@@ -3375,7 +3375,7 @@ char_u *makeswapname(char_u *fname, char_u *ffname, buf_T *buf, char_u *dir_name
return NULL;
s = get_file_in_dir(r, dir_name);
- vim_free(r);
+ free(r);
return s;
}
@@ -3415,7 +3415,7 @@ get_file_in_dir (
t = concat_fnames(fname, dname + 2, TRUE);
*tail = save_char;
retval = concat_fnames(t, tail, TRUE);
- vim_free(t);
+ free(t);
}
} else {
retval = concat_fnames(dname, tail, TRUE);
@@ -3555,7 +3555,7 @@ findswapname (
if (fname == NULL) /* must be out of memory */
break;
if ((n = (int)STRLEN(fname)) == 0) { /* safety check */
- vim_free(fname);
+ free(fname);
fname = NULL;
break;
}
@@ -3700,7 +3700,7 @@ findswapname (
if (process_still_running && choice >= 4)
choice++; /* Skip missing "Delete it" button */
# endif
- vim_free(name);
+ free(name);
/* pretend screen didn't scroll, need redraw anyway */
msg_scrolled = 0;
@@ -3755,7 +3755,7 @@ findswapname (
if (fname[n - 1] == 'a') { /* ".s?a" */
if (fname[n - 2] == 'a') { /* ".saa": tried enough, give up */
EMSG(_("E326: Too many swap files found"));
- vim_free(fname);
+ free(fname);
fname = NULL;
break;
}
@@ -3765,7 +3765,7 @@ findswapname (
--fname[n - 1]; /* ".swo", ".swn", etc. */
}
- vim_free(dir_name);
+ free(dir_name);
return fname;
}
diff --git a/src/memory.c b/src/memory.c
index 14eba71a01..fa066cf2aa 100644
--- a/src/memory.c
+++ b/src/memory.c
@@ -312,8 +312,8 @@ void free_all_mem(void)
clear_sb_text(); /* free any scrollback text */
/* Free some global vars. */
- vim_free(last_cmdline);
- vim_free(new_last_cmdline);
+ free(last_cmdline);
+ free(new_last_cmdline);
set_keep_msg(NULL, 0);
/* Clear cmdline history. */
@@ -383,7 +383,7 @@ void free_all_mem(void)
clear_hl_tables();
- vim_free(NameBuff);
+ free(NameBuff);
}
#endif
diff --git a/src/menu.c b/src/menu.c
index 01f7f4f9d3..e454b8c971 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -203,7 +203,7 @@ ex_menu (
if (p != NULL) {
menu_nable_recurse(root_menu, p, MENU_ALL_MODES,
enable);
- vim_free(p);
+ free(p);
}
}
}
@@ -224,7 +224,7 @@ ex_menu (
p = popup_mode_name(menu_path, i);
if (p != NULL) {
remove_menu(&root_menu, p, MENU_ALL_MODES, TRUE);
- vim_free(p);
+ free(p);
}
}
}
@@ -261,12 +261,12 @@ ex_menu (
menuarg.modes = modes;
add_menu_path(p, &menuarg, pri_tab, map_to
);
- vim_free(p);
+ free(p);
}
}
}
- vim_free(map_buf);
+ free(map_buf);
}
@@ -416,12 +416,12 @@ add_menu_path (
menup = &menu->children;
parent = menu;
name = next_name;
- vim_free(dname);
+ free(dname);
dname = NULL;
if (pri_tab[pri_idx + 1] != -1)
++pri_idx;
}
- vim_free(path_name);
+ free(path_name);
/*
* Only add system menu items which have not been defined yet.
@@ -495,8 +495,8 @@ add_menu_path (
return OK;
erret:
- vim_free(path_name);
- vim_free(dname);
+ free(path_name);
+ free(dname);
/* Delete any empty submenu we added before discovering the error. Repeat
* for higher levels. */
@@ -688,14 +688,14 @@ static void free_menu(vimmenu_T **menup)
/* Don't change *menup until after calling gui_mch_destroy_menu(). The
* MacOS code needs the original structure to properly delete the menu. */
*menup = menu->next;
- vim_free(menu->name);
- vim_free(menu->dname);
- vim_free(menu->en_name);
- vim_free(menu->en_dname);
- vim_free(menu->actext);
+ free(menu->name);
+ free(menu->dname);
+ free(menu->en_name);
+ free(menu->en_dname);
+ free(menu->actext);
for (i = 0; i < MENU_MODES; i++)
free_menu_string(menu, i);
- vim_free(menu);
+ free(menu);
}
@@ -711,7 +711,7 @@ static void free_menu_string(vimmenu_T *menu, int idx)
if (menu->strings[i] == menu->strings[idx])
count++;
if (count == 1)
- vim_free(menu->strings[idx]);
+ free(menu->strings[idx]);
menu->strings[idx] = NULL;
}
@@ -738,11 +738,11 @@ static int show_menus(char_u *path_name, int modes)
/* Found menu */
if (*p != NUL && menu->children == NULL) {
EMSG(_(e_notsubmenu));
- vim_free(path_name);
+ free(path_name);
return FAIL;
} else if ((menu->modes & modes) == 0x0) {
EMSG(_(e_othermode));
- vim_free(path_name);
+ free(path_name);
return FAIL;
}
break;
@@ -751,14 +751,14 @@ static int show_menus(char_u *path_name, int modes)
}
if (menu == NULL) {
EMSG2(_(e_nomenu), name);
- vim_free(path_name);
+ free(path_name);
return FAIL;
}
name = p;
parent = menu;
menu = menu->children;
}
- vim_free(path_name);
+ free(path_name);
/* Now we have found the matching menu, and we list the mappings */
/* Highlight title */
@@ -920,7 +920,7 @@ char_u *set_context_in_menu_cmd(expand_T *xp, char_u *cmd, char_u *arg, int forc
* Menu path continues, but we have reached a leaf.
* Or menu exists only in another mode.
*/
- vim_free(path_name);
+ free(path_name);
return NULL;
}
break;
@@ -929,13 +929,13 @@ char_u *set_context_in_menu_cmd(expand_T *xp, char_u *cmd, char_u *arg, int forc
}
if (menu == NULL) {
/* No menu found with the name we were looking for */
- vim_free(path_name);
+ free(path_name);
return NULL;
}
name = p;
menu = menu->children;
}
- vim_free(path_name);
+ free(path_name);
xp->xp_context = expand_menus ? EXPAND_MENUNAMES : EXPAND_MENUS;
xp->xp_pattern = after_dot;
@@ -1331,7 +1331,7 @@ void ex_emenu(exarg_T *eap)
menu = menu->children;
name = p;
}
- vim_free(saved_name);
+ free(saved_name);
if (menu == NULL) {
EMSG2(_("E334: Menu not found: %s"), eap->arg);
return;
@@ -1454,7 +1454,7 @@ vimmenu_T *gui_find_menu(char_u *path_name)
if (menu == NULL)
EMSG(_("E337: Menu not found - check menu names"));
theend:
- vim_free(saved_name);
+ free(saved_name);
return menu;
}
#endif
@@ -1492,9 +1492,9 @@ void ex_menutranslate(exarg_T *eap)
if (STRNCMP(arg, "clear", 5) == 0 && ends_excmd(*skipwhite(arg + 5))) {
tp = (menutrans_T *)menutrans_ga.ga_data;
for (i = 0; i < menutrans_ga.ga_len; ++i) {
- vim_free(tp[i].from);
- vim_free(tp[i].from_noamp);
- vim_free(tp[i].to);
+ free(tp[i].from);
+ free(tp[i].from_noamp);
+ free(tp[i].to);
}
ga_clear(&menutrans_ga);
/* Delete all "menutrans_" global variables. */
@@ -1525,9 +1525,9 @@ void ex_menutranslate(exarg_T *eap)
tp[menutrans_ga.ga_len].to = to;
++menutrans_ga.ga_len;
} else {
- vim_free(from);
- vim_free(from_noamp);
- vim_free(to);
+ free(from);
+ free(from_noamp);
+ free(to);
}
}
}
@@ -1569,10 +1569,10 @@ static char_u *menutrans_lookup(char_u *name, int len)
if (dname != NULL) {
for (i = 0; i < menutrans_ga.ga_len; ++i)
if (STRCMP(dname, tp[i].from_noamp) == 0) {
- vim_free(dname);
+ free(dname);
return tp[i].to;
}
- vim_free(dname);
+ free(dname);
}
return NULL;
diff --git a/src/message.c b/src/message.c
index 89bd787d5c..402b899dd8 100644
--- a/src/message.c
+++ b/src/message.c
@@ -198,7 +198,7 @@ msg_attr_keep (
* Columns + sc_col)
set_keep_msg(s, 0);
- vim_free(buf);
+ free(buf);
--entered;
return retval;
}
@@ -362,7 +362,7 @@ static char_u *last_sourcing_name = NULL;
*/
void reset_last_sourcing(void)
{
- vim_free(last_sourcing_name);
+ free(last_sourcing_name);
last_sourcing_name = NULL;
last_sourcing_lnum = 0;
}
@@ -433,18 +433,18 @@ void msg_source(int attr)
p = get_emsg_source();
if (p != NULL) {
msg_attr(p, attr);
- vim_free(p);
+ free(p);
}
p = get_emsg_lnum();
if (p != NULL) {
msg_attr(p, hl_attr(HLF_N));
- vim_free(p);
+ free(p);
last_sourcing_lnum = sourcing_lnum; /* only once for each line */
}
/* remember the last sourcing name printed, also when it's empty */
if (sourcing_name == NULL || other_sourcing_name()) {
- vim_free(last_sourcing_name);
+ free(last_sourcing_name);
if (sourcing_name == NULL)
last_sourcing_name = NULL;
else
@@ -525,13 +525,13 @@ int emsg(char_u *s)
if (p != NULL) {
STRCAT(p, "\n");
redir_write(p, -1);
- vim_free(p);
+ free(p);
}
p = get_emsg_lnum();
if (p != NULL) {
STRCAT(p, "\n");
redir_write(p, -1);
- vim_free(p);
+ free(p);
}
redir_write(s, -1);
return TRUE;
@@ -695,8 +695,8 @@ int delete_first_msg(void)
first_msg_hist = p->next;
if (first_msg_hist == NULL)
last_msg_hist = NULL; /* history is empty */
- vim_free(p->msg);
- vim_free(p);
+ free(p->msg);
+ free(p);
--msg_hist_len;
return OK;
}
@@ -930,7 +930,7 @@ void wait_return(int redraw)
reset_last_sourcing();
if (keep_msg != NULL && vim_strsize(keep_msg) >=
(Rows - cmdline_row - 1) * Columns + sc_col) {
- vim_free(keep_msg);
+ free(keep_msg);
keep_msg = NULL; /* don't redisplay message, it's too long */
}
@@ -968,7 +968,7 @@ static void hit_return_msg(void)
*/
void set_keep_msg(char_u *s, int attr)
{
- vim_free(keep_msg);
+ free(keep_msg);
if (s != NULL && msg_silent == 0)
keep_msg = vim_strsave(s);
else
@@ -996,7 +996,7 @@ void msg_start(void)
int did_return = FALSE;
if (!msg_silent) {
- vim_free(keep_msg);
+ free(keep_msg);
keep_msg = NULL; /* don't display old message now */
}
@@ -1084,7 +1084,7 @@ static void msg_home_replace_attr(char_u *fname, int attr)
name = home_replace_save(NULL, fname);
if (name != NULL)
msg_outtrans_attr(name, attr);
- vim_free(name);
+ free(name);
}
/*
@@ -1817,7 +1817,7 @@ static void inc_msg_scrolled(void)
p = tofree;
}
set_vim_var_string(VV_SCROLLSTART, p, -1);
- vim_free(tofree);
+ free(tofree);
}
++msg_scrolled;
}
@@ -1903,7 +1903,7 @@ void clear_sb_text(void)
while (last_msgchunk != NULL) {
mp = last_msgchunk->sb_prev;
- vim_free(last_msgchunk);
+ free(last_msgchunk);
last_msgchunk = mp;
}
}
@@ -2652,7 +2652,7 @@ void give_warning(char_u *message, int hl)
++no_wait_return;
set_vim_var_string(VV_WARNINGMSG, message, -1);
- vim_free(keep_msg);
+ free(keep_msg);
keep_msg = NULL;
if (hl)
keep_msg_attr = hl_attr(HLF_W);
@@ -2783,7 +2783,7 @@ do_dialog (
break;
}
- vim_free(hotkeys);
+ free(hotkeys);
}
State = oldState;
@@ -2936,7 +2936,7 @@ static char_u *msg_show_console_dialog(char_u *message, char_u *buttons, int dfl
/*
* Now allocate and load the strings
*/
- vim_free(confirm_msg);
+ free(confirm_msg);
confirm_msg = alloc(len);
*confirm_msg = NUL;
hotk = alloc(lenhotkey);
diff --git a/src/misc1.c b/src/misc1.c
index 21fb8face1..3f8a1b934a 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -927,16 +927,16 @@ open_line (
curwin->w_cursor.col = 0;
curwin->w_cursor.coladd = 0;
ins_bytes(p_extra); /* will call changed_bytes() */
- vim_free(p_extra);
+ free(p_extra);
next_line = NULL;
}
retval = TRUE; /* success! */
theend:
curbuf->b_p_pi = saved_pi;
- vim_free(saved_line);
- vim_free(next_line);
- vim_free(allocated);
+ free(saved_line);
+ free(next_line);
+ free(allocated);
return retval;
}
@@ -2470,7 +2470,7 @@ int get_keystroke(void)
#endif
break;
}
- vim_free(buf);
+ free(buf);
mapped_ctrl_c = save_mapped_ctrl_c;
return n;
@@ -2667,7 +2667,7 @@ void init_homedir(void)
char_u *var;
/* In case we are called a second time (when 'encoding' changes). */
- vim_free(homedir);
+ free(homedir);
homedir = NULL;
var = (char_u *)os_getenv("HOME");
@@ -2697,7 +2697,7 @@ void init_homedir(void)
#if defined(EXITFREE) || defined(PROTO)
void free_homedir(void)
{
- vim_free(homedir);
+ free(homedir);
}
void free_users(void)
@@ -2875,7 +2875,7 @@ expand_env_esc (
if (p != NULL) {
if (mustfree)
- vim_free(var);
+ free(var);
var = p;
mustfree = TRUE;
forward_slash(var);
@@ -2890,7 +2890,7 @@ expand_env_esc (
if (p != NULL) {
if (mustfree)
- vim_free(var);
+ free(var);
var = p;
mustfree = TRUE;
}
@@ -2914,7 +2914,7 @@ expand_env_esc (
copy_char = FALSE;
}
if (mustfree)
- vim_free(var);
+ free(var);
}
if (copy_char) { /* copy at least one char */
@@ -3033,13 +3033,13 @@ char_u *vim_getenv(char_u *name, int *mustfree)
p = vim_strnsave(p, (int)(pend - p));
if (p != NULL && !os_isdir(p)) {
- vim_free(p);
+ free(p);
p = NULL;
} else {
#ifdef USE_EXE_NAME
/* may add "/vim54" or "/runtime" if it exists */
if (vimruntime && (pend = vim_version_dir(p)) != NULL) {
- vim_free(p);
+ free(p);
p = pend;
}
#endif
@@ -3096,11 +3096,11 @@ static char_u *vim_version_dir(char_u *vimdir)
p = concat_fnames(vimdir, (char_u *)VIM_VERSION_NODOT, TRUE);
if (os_isdir(p))
return p;
- vim_free(p);
+ free(p);
p = concat_fnames(vimdir, (char_u *)RUNTIME_DIRNAME, TRUE);
if (os_isdir(p))
return p;
- vim_free(p);
+ free(p);
return NULL;
}
@@ -3133,7 +3133,7 @@ void vim_setenv(char_u *name, char_u *val)
if (*val != NUL && STRICMP(name, "VIMRUNTIME") == 0) {
char_u *buf = concat_str(val, (char_u *)"/lang");
bindtextdomain(VIMPACKAGE, (char *)buf);
- vim_free(buf);
+ free(buf);
}
}
@@ -3149,7 +3149,7 @@ char_u *get_env_name(expand_T *xp, int idx)
char *envname = os_getenvname_at_index(idx);
if (envname) {
vim_strncpy(name, (char_u *)envname, ENVNAMELEN - 1);
- vim_free(envname);
+ free(envname);
return name;
} else {
return NULL;
@@ -3317,7 +3317,7 @@ home_replace (
*dst = NUL;
if (homedir_env != homedir_env_orig)
- vim_free(homedir_env);
+ free(homedir_env);
}
/*
@@ -3481,7 +3481,7 @@ get_cmd_output (
call_shell(command, kShellOptDoOut | kShellOptExpand | flags, NULL);
--no_check_timestamps;
- vim_free(command);
+ free(command);
/*
* read the names from the file into memory
@@ -3505,7 +3505,7 @@ get_cmd_output (
goto done;
if (i != len) {
EMSG2(_(e_notread), tempname);
- vim_free(buffer);
+ free(buffer);
buffer = NULL;
} else {
/* Change NUL into SOH, otherwise the string is truncated. */
@@ -3517,7 +3517,7 @@ get_cmd_output (
}
done:
- vim_free(tempname);
+ free(tempname);
return buffer;
}
@@ -3530,8 +3530,8 @@ void FreeWild(int count, char_u **files)
if (count <= 0 || files == NULL)
return;
while (count--)
- vim_free(files[count]);
- vim_free(files);
+ free(files[count]);
+ free(files);
}
/*
diff --git a/src/misc2.c b/src/misc2.c
index e50f09857c..e25918a2f5 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -781,10 +781,10 @@ int call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg)
: STRCMP(p_sxq, "\"(") == 0 ? (char_u *)")\""
: p_sxq);
retval = os_call_shell(ncmd, opts, extra_shell_arg);
- vim_free(ncmd);
+ free(ncmd);
if (ecmd != cmd)
- vim_free(ecmd);
+ free(ecmd);
}
/*
* Check the window size, in case it changed while executing the
@@ -868,7 +868,7 @@ int vim_chdir(char_u *new_dir)
if (dir_name == NULL)
return -1;
r = os_chdir((char *)dir_name);
- vim_free(dir_name);
+ free(dir_name);
return r;
}
@@ -976,7 +976,7 @@ char_u *read_string(FILE *fd, int cnt)
for (i = 0; i < cnt; ++i) {
c = getc(fd);
if (c == EOF) {
- vim_free(str);
+ free(str);
return NULL;
}
str[i] = c;
diff --git a/src/normal.c b/src/normal.c
index 9ef3912234..dc0035fe85 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -1088,7 +1088,7 @@ getcount:
/* now reset it, otherwise it's put in the history again */
keep_msg = kmsg;
msg_attr(kmsg, keep_msg_attr);
- vim_free(kmsg);
+ free(kmsg);
}
setcursor();
cursor_on();
@@ -1124,7 +1124,7 @@ normal_end:
clear_showcmd();
checkpcmark(); /* check if we moved since setting pcmark */
- vim_free(ca.searchbuf);
+ free(ca.searchbuf);
if (has_mbyte)
mb_adjust_cursor();
@@ -1265,7 +1265,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
else {
AppendToRedobuffLit(repeat_cmdline, -1);
AppendToRedobuff(NL_STR);
- vim_free(repeat_cmdline);
+ free(repeat_cmdline);
repeat_cmdline = NULL;
}
}
@@ -3466,7 +3466,7 @@ find_decl (
reset_search_dir();
}
- vim_free(pat);
+ free(pat);
p_ws = save_p_ws;
p_scs = save_p_scs;
@@ -4387,7 +4387,7 @@ static void nv_ident(cmdarg_T *cap)
}
if (n == 0) {
EMSG(_(e_noident)); /* found dashes only */
- vim_free(buf);
+ free(buf);
return;
}
@@ -4438,11 +4438,11 @@ static void nv_ident(cmdarg_T *cap)
/* Escape the argument properly for a shell command */
ptr = vim_strnsave(ptr, n);
p = vim_strsave_shellescape(ptr, true, true);
- vim_free(ptr);
+ free(ptr);
newbuf = (char_u *)xrealloc(buf, STRLEN(buf) + STRLEN(p) + 1);
buf = newbuf;
STRCAT(buf, p);
- vim_free(p);
+ free(p);
} else {
if (cmdchar == '*')
aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
@@ -4491,7 +4491,7 @@ static void nv_ident(cmdarg_T *cap)
} else
do_cmdline_cmd(buf);
- vim_free(buf);
+ free(buf);
}
/*
@@ -4850,7 +4850,7 @@ static void nv_gotofile(cmdarg_T *cap)
check_cursor_lnum();
beginline(BL_SOL | BL_FIX);
}
- vim_free(ptr);
+ free(ptr);
} else
clearop(cap->oap);
}
diff --git a/src/ops.c b/src/ops.c
index 4fcc0d607e..f729f4e06b 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -656,7 +656,7 @@ int get_expr_register(void)
if (new_line == NULL)
return NUL;
if (*new_line == NUL) /* use previous line */
- vim_free(new_line);
+ free(new_line);
else
set_expr_line(new_line);
return '=';
@@ -668,7 +668,7 @@ int get_expr_register(void)
*/
void set_expr_line(char_u *new_line)
{
- vim_free(expr_line);
+ free(expr_line);
expr_line = new_line;
}
@@ -699,7 +699,7 @@ char_u *get_expr_line(void)
++nested;
rv = eval_to_string(expr_copy, NULL, TRUE);
--nested;
- vim_free(expr_copy);
+ free(expr_copy);
return rv;
}
@@ -807,7 +807,7 @@ void put_register(int name, void *reg)
get_yank_register(name, 0);
free_yank_all();
*y_current = *(struct yankreg *)reg;
- vim_free(reg);
+ free(reg);
}
@@ -890,11 +890,11 @@ static int stuff_yank(int regname, char_u *p)
/* check for read-only register */
if (regname != 0 && !valid_yank_reg(regname, TRUE)) {
- vim_free(p);
+ free(p);
return FAIL;
}
if (regname == '_') { /* black hole: don't do anything */
- vim_free(p);
+ free(p);
return OK;
}
get_yank_register(regname, TRUE);
@@ -903,8 +903,8 @@ static int stuff_yank(int regname, char_u *p)
lp = lalloc((long_u)(STRLEN(*pp) + STRLEN(p) + 1), TRUE);
STRCPY(lp, *pp);
STRCAT(lp, p);
- vim_free(p);
- vim_free(*pp);
+ free(p);
+ free(*pp);
*pp = lp;
} else {
free_yank_all();
@@ -959,7 +959,7 @@ do_execreg (
EMSG(_(e_nolastcmd));
return FAIL;
}
- vim_free(new_last_cmdline); /* don't keep the cmdline containing @: */
+ free(new_last_cmdline); /* don't keep the cmdline containing @: */
new_last_cmdline = NULL;
/* Escape all control characters with a CTRL-V */
p = vim_strsave_escaped_ext(
@@ -975,13 +975,13 @@ do_execreg (
else
retval = put_in_typebuf(p, TRUE, TRUE, silent);
}
- vim_free(p);
+ free(p);
} else if (regname == '=') {
p = get_expr_line();
if (p == NULL)
return FAIL;
retval = put_in_typebuf(p, TRUE, colon, silent);
- vim_free(p);
+ free(p);
} else if (regname == '.') { /* use last inserted text */
p = get_last_insert_save();
if (p == NULL) {
@@ -989,7 +989,7 @@ do_execreg (
return FAIL;
}
retval = put_in_typebuf(p, FALSE, colon, silent);
- vim_free(p);
+ free(p);
} else {
get_yank_register(regname, FALSE);
if (y_current->y_array == NULL)
@@ -1015,7 +1015,7 @@ do_execreg (
if (escaped == NULL)
return FAIL;
retval = ins_typebuf(escaped, remap, 0, TRUE, silent);
- vim_free(escaped);
+ free(escaped);
if (retval == FAIL)
return FAIL;
if (colon && ins_typebuf((char_u *)":", remap, 0, TRUE, silent)
@@ -1081,7 +1081,7 @@ put_in_typebuf (
retval = ins_typebuf(p, esc ? REMAP_NONE : REMAP_YES,
0, TRUE, silent);
if (esc)
- vim_free(p);
+ free(p);
}
if (colon && retval == OK)
retval = ins_typebuf((char_u *)":", REMAP_NONE, 0, TRUE, silent);
@@ -1126,7 +1126,7 @@ insert_reg (
return FAIL;
stuffescaped(arg, literally);
if (allocated)
- vim_free(arg);
+ free(arg);
} else { /* name or number register */
get_yank_register(regname, FALSE);
if (y_current->y_array == NULL)
@@ -1780,7 +1780,7 @@ int op_replace(oparg_T *oap, int c)
ml_append(curwin->w_cursor.lnum++, after_p, 0, FALSE);
appended_lines_mark(curwin->w_cursor.lnum, 1L);
oap->end.lnum++;
- vim_free(after_p);
+ free(after_p);
}
}
} else {
@@ -2164,7 +2164,7 @@ void op_insert(oparg_T *oap, long count1)
curwin->w_cursor.col = oap->start.col;
check_cursor();
- vim_free(ins_text);
+ free(ins_text);
}
}
}
@@ -2278,7 +2278,7 @@ int op_change(oparg_T *oap)
}
check_cursor();
changed_lines(oap->start.lnum + 1, 0, oap->end.lnum + 1, 0L);
- vim_free(ins_text);
+ free(ins_text);
}
}
@@ -2320,9 +2320,9 @@ static void free_yank(long n)
long i;
for (i = n; --i >= 0; ) {
- vim_free(y_current->y_array[i]);
+ free(y_current->y_array[i]);
}
- vim_free(y_current->y_array);
+ free(y_current->y_array);
y_current->y_array = NULL;
}
}
@@ -2492,7 +2492,7 @@ int op_yank(oparg_T *oap, int deleting, int mess)
TRUE);
for (j = 0; j < curr->y_size; ++j)
new_ptr[j] = curr->y_array[j];
- vim_free(curr->y_array);
+ free(curr->y_array);
curr->y_array = new_ptr;
if (yanktype == MLINE) /* MLINE overrides MCHAR and MBLOCK */
@@ -2505,8 +2505,8 @@ int op_yank(oparg_T *oap, int deleting, int mess)
+ STRLEN(y_current->y_array[0]) + 1), TRUE);
STRCPY(pnew, curr->y_array[--j]);
STRCAT(pnew, y_current->y_array[0]);
- vim_free(curr->y_array[j]);
- vim_free(y_current->y_array[0]);
+ free(curr->y_array[j]);
+ free(y_current->y_array[0]);
curr->y_array[j++] = pnew;
y_idx = 1;
} else
@@ -2514,7 +2514,7 @@ int op_yank(oparg_T *oap, int deleting, int mess)
while (y_idx < y_current->y_size)
curr->y_array[j++] = y_current->y_array[y_idx++];
curr->y_size = j;
- vim_free(y_current->y_array);
+ free(y_current->y_array);
y_current = curr;
}
if (mess) { /* Display message about yank? */
@@ -2706,7 +2706,7 @@ do_put (
if (ptr == NULL)
goto end;
ml_append(curwin->w_cursor.lnum, ptr, (colnr_T)0, FALSE);
- vim_free(ptr);
+ free(ptr);
ptr = vim_strnsave(ml_get_curline(), curwin->w_cursor.col);
if (ptr == NULL)
@@ -3020,7 +3020,7 @@ do_put (
STRCAT(newp, ptr);
/* insert second line */
ml_append(lnum, newp, (colnr_T)0, FALSE);
- vim_free(newp);
+ free(newp);
oldp = ml_get(lnum);
newp = (char_u *) xmalloc((size_t)(col + yanklen + 1));
@@ -3125,9 +3125,9 @@ error:
end:
if (allocated)
- vim_free(insert_string);
+ free(insert_string);
if (regname == '=')
- vim_free(y_array);
+ free(y_array);
VIsual_active = FALSE;
@@ -3580,9 +3580,9 @@ int do_join(long count, int insert_space, int save_undo, int use_formatoptions)
curwin->w_set_curswant = TRUE;
theend:
- vim_free(spaces);
+ free(spaces);
if (remove_comments)
- vim_free(comments);
+ free(comments);
return ret;
}
@@ -3644,7 +3644,7 @@ static int same_leader(linenr_T lnum, int leader1_len, char_u *leader1_flags, in
while (vim_iswhite(line1[idx1]))
++idx1;
}
- vim_free(line1);
+ free(line1);
}
return idx2 == leader2_len && idx1 == leader1_len;
}
@@ -4444,7 +4444,7 @@ int do_addsub(int command, linenr_T Prenum1)
*ptr = NUL;
STRCAT(buf1, buf2);
ins_str(buf1); /* insert the new number */
- vim_free(buf1);
+ free(buf1);
}
--curwin->w_cursor.col;
curwin->w_set_curswant = TRUE;
@@ -4493,7 +4493,7 @@ int read_viminfo_register(vir_T *virp, int force)
if (do_it) {
if (set_prev)
y_previous = y_current;
- vim_free(y_current->y_array);
+ free(y_current->y_array);
array = y_current->y_array =
(char_u **)alloc((unsigned)(limit * sizeof(char_u *)));
str = skipwhite(skiptowhite(str));
@@ -4516,7 +4516,7 @@ int read_viminfo_register(vir_T *virp, int force)
alloc((unsigned)(limit * 2 * sizeof(char_u *)));
for (i = 0; i < limit; i++)
y_current->y_array[i] = array[i];
- vim_free(array);
+ free(array);
limit *= 2;
array = y_current->y_array;
}
@@ -4529,14 +4529,14 @@ int read_viminfo_register(vir_T *virp, int force)
}
if (do_it) {
if (size == 0) {
- vim_free(array);
+ free(array);
y_current->y_array = NULL;
} else if (size < limit) {
y_current->y_array =
(char_u **)alloc((unsigned)(size * sizeof(char_u *)));
for (i = 0; i < size; i++)
y_current->y_array[i] = array[i];
- vim_free(array);
+ free(array);
}
y_current->y_size = size;
}
@@ -4784,7 +4784,7 @@ void write_reg_contents_ex(int name, char_u *str, int maxlen, int must_append, i
return;
if (must_append) {
s = concat_str(get_expr_line_src(), p);
- vim_free(p);
+ free(p);
p = s;
}
@@ -4873,7 +4873,7 @@ str_to_reg (
pp = xcalloc((y_ptr->y_size + newlines), sizeof(char_u *));
for (lnum = 0; lnum < y_ptr->y_size; ++lnum)
pp[lnum] = y_ptr->y_array[lnum];
- vim_free(y_ptr->y_array);
+ free(y_ptr->y_array);
y_ptr->y_array = pp;
maxlen = 0;
@@ -4896,7 +4896,7 @@ str_to_reg (
if (extra)
memmove(s, y_ptr->y_array[lnum], (size_t)extra);
if (append)
- vim_free(y_ptr->y_array[lnum]);
+ free(y_ptr->y_array[lnum]);
if (i)
memmove(s + extra, str + start, (size_t)i);
extra += i;
diff --git a/src/option.c b/src/option.c
index 574478d524..56f86e34fd 100644
--- a/src/option.c
+++ b/src/option.c
@@ -320,7 +320,7 @@ struct vimoption {
never be used for local or hidden options! */
#define P_NODEFAULT 0x40 /* don't set to default value */
#define P_DEF_ALLOCED 0x80 /* default value is in allocated memory, must
- use vim_free() when assigning new value */
+ use free() when assigning new value */
#define P_WAS_SET 0x100 /* option has been set/reset */
#define P_NO_MKRC 0x200 /* don't include in :mkvimrc output */
#define P_VI_DEF 0x400 /* Use Vi default for Vim */
@@ -1970,11 +1970,11 @@ void set_init_1(void)
ga.ga_len += len;
}
if (mustfree)
- vim_free(p);
+ free(p);
}
if (ga.ga_data != NULL) {
set_string_default("bsk", ga.ga_data);
- vim_free(ga.ga_data);
+ free(ga.ga_data);
}
}
@@ -2038,10 +2038,10 @@ void set_init_1(void)
options[opt_idx].def_val[VI_DEFAULT] = buf;
options[opt_idx].flags |= P_DEF_ALLOCED;
} else
- vim_free(buf); /* cannot happen */
+ free(buf); /* cannot happen */
}
if (mustfree)
- vim_free(cdpath);
+ free(cdpath);
}
}
@@ -2108,7 +2108,7 @@ void set_init_1(void)
* split P_DEF_ALLOCED in two.
*/
if (options[opt_idx].flags & P_DEF_ALLOCED)
- vim_free(options[opt_idx].def_val[VI_DEFAULT]);
+ free(options[opt_idx].def_val[VI_DEFAULT]);
options[opt_idx].def_val[VI_DEFAULT] = p;
options[opt_idx].flags |= P_DEF_ALLOCED;
}
@@ -2154,7 +2154,7 @@ void set_init_1(void)
* for practical purposes, thus use that. It's not an alias to
* still support conversion between gb18030 and utf-8. */
p_enc = vim_strsave((char_u *)"cp936");
- vim_free(p);
+ free(p);
}
if (mb_init() == NULL) {
opt_idx = findoption((char_u *)"encoding");
@@ -2185,7 +2185,7 @@ void set_init_1(void)
#endif
} else {
- vim_free(p_enc);
+ free(p_enc);
p_enc = save_enc;
}
}
@@ -2293,7 +2293,7 @@ void set_string_default(char *name, char_u *val)
opt_idx = findoption((char_u *)name);
if (opt_idx >= 0) {
if (options[opt_idx].flags & P_DEF_ALLOCED)
- vim_free(options[opt_idx].def_val[VI_DEFAULT]);
+ free(options[opt_idx].def_val[VI_DEFAULT]);
options[opt_idx].def_val[VI_DEFAULT] = p;
options[opt_idx].flags |= P_DEF_ALLOCED;
}
@@ -2494,7 +2494,7 @@ void set_init_3(void)
options[idx_srr].def_val[VI_DEFAULT] = p_srr;
}
}
- vim_free(p);
+ free(p);
}
#endif
@@ -3031,7 +3031,7 @@ do_set (
(char_u *)"indent,eol,start");
break;
}
- vim_free(oldval);
+ free(oldval);
oldval = *(char_u **)varp;
}
/*
@@ -3128,7 +3128,7 @@ do_set (
|| (flags & P_COMMA)) {
s = option_expand(opt_idx, newval);
if (s != NULL) {
- vim_free(newval);
+ free(newval);
newlen = (unsigned)STRLEN(s) + 1;
if (adding || prepending || removing)
newlen += (unsigned)STRLEN(origval) + 1;
@@ -3640,13 +3640,13 @@ void check_buf_options(buf_T *buf)
void free_string_option(char_u *p)
{
if (p != empty_option)
- vim_free(p);
+ free(p);
}
void clear_string_option(char_u **pp)
{
if (*pp != empty_option)
- vim_free(*pp);
+ free(*pp);
*pp = empty_option;
}
@@ -4047,7 +4047,7 @@ did_set_string_option (
/* canonize the value, so that STRCMP() can be used on it */
p = enc_canonize(*varp);
if (p != NULL) {
- vim_free(*varp);
+ free(*varp);
*varp = p;
}
if (varp == &p_enc) {
@@ -4076,7 +4076,7 @@ did_set_string_option (
/* Canonize printencoding if VIM standard one */
p = enc_canonize(p_penc);
if (p != NULL) {
- vim_free(p_penc);
+ free(p_penc);
p_penc = p;
} else {
/* Ensure lower case and '-' for '_' */
@@ -4323,7 +4323,7 @@ did_set_string_option (
t_colors = colors;
if (t_colors <= 1) {
if (new_value_alloced)
- vim_free(T_CCO);
+ free(T_CCO);
T_CCO = empty_option;
}
/* We now have a different color setup, initialize it again. */
@@ -4829,7 +4829,7 @@ skip:
return e_invarg; /* illegal trailing comma as in "set cc=80," */
}
- vim_free(wp->w_p_cc_cols);
+ free(wp->w_p_cc_cols);
if (count == 0)
wp->w_p_cc_cols = NULL;
else {
@@ -5023,7 +5023,7 @@ static char_u *compile_cap_prog(synblock_T *synblock)
/* Prepend a ^ so that we only match at one column */
re = concat_str((char_u *)"^", synblock->b_p_spc);
synblock->b_cap_prog = vim_regcomp(re, RE_MAGIC);
- vim_free(re);
+ free(re);
if (synblock->b_cap_prog == NULL) {
synblock->b_cap_prog = rp; /* restore the previous program */
return e_invarg;
@@ -6173,7 +6173,7 @@ showoptions (
ui_breakcheck();
}
}
- vim_free(items);
+ free(items);
}
/*
@@ -6395,10 +6395,10 @@ static int put_setstring(FILE *fd, char *cmd, char *name, char_u **valuep, int e
buf = alloc(MAXPATHL);
home_replace(NULL, *valuep, buf, MAXPATHL, FALSE);
if (put_escstr(fd, buf, 2) == FAIL) {
- vim_free(buf);
+ free(buf);
return FAIL;
}
- vim_free(buf);
+ free(buf);
} else if (put_escstr(fd, *valuep, 2) == FAIL)
return FAIL;
}
@@ -7393,7 +7393,7 @@ int ExpandOldSetting(int *num_file, char_u ***file)
buf = vim_strsave_escaped(var, escape_chars);
if (buf == NULL) {
- vim_free(*file);
+ free(*file);
*file = NULL;
return FAIL;
}
@@ -7785,10 +7785,10 @@ void vimrc_found(char_u *fname, char_u *envname)
p = FullName_save(fname, FALSE);
if (p != NULL) {
vim_setenv(envname, p);
- vim_free(p);
+ free(p);
}
} else if (dofree)
- vim_free(p);
+ free(p);
}
}
@@ -8002,7 +8002,7 @@ void save_file_ff(buf_T *buf)
/* Only use free/alloc when necessary, they take time. */
if (buf->b_start_fenc == NULL
|| STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0) {
- vim_free(buf->b_start_fenc);
+ free(buf->b_start_fenc);
buf->b_start_fenc = vim_strsave(buf->b_p_fenc);
}
}
diff --git a/src/os/fs.c b/src/os/fs.c
index f9b02375e1..e03d06669d 100644
--- a/src/os/fs.c
+++ b/src/os/fs.c
@@ -106,13 +106,13 @@ static bool is_executable_in_path(const char_u *name)
if (is_executable(buf)) {
// Found our executable. Free buf and return.
- vim_free(buf);
+ free(buf);
return true;
}
if (*e != ':') {
// End of $PATH without finding any executable called name.
- vim_free(buf);
+ free(buf);
return false;
}
diff --git a/src/os_unix.c b/src/os_unix.c
index ceb6a31386..287b5e7d60 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -172,7 +172,7 @@ void mch_suspend()
/*
* Set oldtitle to NULL, so the current title is obtained again.
*/
- vim_free(oldtitle);
+ free(oldtitle);
oldtitle = NULL;
settmode(TMODE_RAW);
need_check_timestamps = TRUE;
@@ -546,8 +546,8 @@ void mch_early_init()
#if defined(EXITFREE) || defined(PROTO)
void mch_free_mem() {
- vim_free(oldtitle);
- vim_free(oldicon);
+ free(oldtitle);
+ free(oldicon);
}
#endif
@@ -1228,11 +1228,11 @@ int flags; /* EW_* flags */
if (ampersent)
os_delay(10L, TRUE);
- vim_free(command);
+ free(command);
if (i != 0) { /* mch_call_shell() failed */
os_remove((char *)tempname);
- vim_free(tempname);
+ free(tempname);
/*
* With interactive completion, the error message is not printed.
*/
@@ -1262,7 +1262,7 @@ int flags; /* EW_* flags */
MSG(_(e_wildexpand));
msg_start(); /* don't overwrite this message */
}
- vim_free(tempname);
+ free(tempname);
goto notfound;
}
fseek(fd, 0L, SEEK_END);
@@ -1275,11 +1275,11 @@ int flags; /* EW_* flags */
if (i != (int)len) {
/* unexpected read error */
EMSG2(_(e_notread), tempname);
- vim_free(tempname);
- vim_free(buffer);
+ free(tempname);
+ free(buffer);
return FAIL;
}
- vim_free(tempname);
+ free(tempname);
@@ -1348,7 +1348,7 @@ int flags; /* EW_* flags */
* /bin/sh will happily expand it to nothing rather than returning an
* error; and hey, it's good to check anyway -- webb.
*/
- vim_free(buffer);
+ free(buffer);
goto notfound;
}
*num_file = i;
@@ -1402,11 +1402,11 @@ int flags; /* EW_* flags */
add_pathsep(p); /* add '/' to a directory name */
(*file)[j++] = p;
}
- vim_free(buffer);
+ free(buffer);
*num_file = j;
if (*num_file == 0) { /* rejected all entries */
- vim_free(*file);
+ free(*file);
*file = NULL;
goto notfound;
}
diff --git a/src/path.c b/src/path.c
index dfcd589b1f..93366c93ab 100644
--- a/src/path.c
+++ b/src/path.c
@@ -316,7 +316,7 @@ FullName_save (
new_fname = vim_strsave(buf);
else
new_fname = vim_strsave(fname);
- vim_free(buf);
+ free(buf);
}
return new_fname;
}
@@ -434,7 +434,7 @@ unix_expandpath (
starts_with_dot = (*s == '.');
pat = file_pat_to_reg_pat(s, e, NULL, FALSE);
if (pat == NULL) {
- vim_free(buf);
+ free(buf);
return 0;
}
@@ -448,10 +448,10 @@ unix_expandpath (
regmatch.regprog = vim_regcomp(pat, RE_MAGIC);
if (flags & (EW_NOERROR | EW_NOTWILD))
--emsg_silent;
- vim_free(pat);
+ free(pat);
if (regmatch.regprog == NULL && (flags & EW_NOTWILD) == 0) {
- vim_free(buf);
+ free(buf);
return 0;
}
@@ -511,7 +511,7 @@ unix_expandpath (
if (precomp_buf) {
memmove(buf, precomp_buf, precomp_len);
- vim_free(precomp_buf);
+ free(precomp_buf);
}
#endif
addfile(gap, buf, flags);
@@ -523,7 +523,7 @@ unix_expandpath (
closedir(dirp);
}
- vim_free(buf);
+ free(buf);
vim_regfree(regmatch.regprog);
matches = gap->ga_len - start_len;
@@ -654,7 +654,7 @@ static void expand_path_option(char_u *curdir, garray_T *gap)
((char_u **)gap->ga_data)[gap->ga_len++] = p;
}
- vim_free(buf);
+ free(buf);
}
/*
@@ -727,13 +727,13 @@ static void uniquefy_paths(garray_T *gap, char_u *pattern)
file_pattern[1] = NUL;
STRCAT(file_pattern, pattern);
pat = file_pat_to_reg_pat(file_pattern, NULL, NULL, TRUE);
- vim_free(file_pattern);
+ free(file_pattern);
if (pat == NULL)
return;
regmatch.rm_ic = TRUE; /* always ignore case */
regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING);
- vim_free(pat);
+ free(pat);
if (regmatch.regprog == NULL)
return;
@@ -818,17 +818,17 @@ static void uniquefy_paths(garray_T *gap, char_u *pattern)
add_pathsep(rel_path);
STRCAT(rel_path, short_name);
- vim_free(fnames[i]);
+ free(fnames[i]);
fnames[i] = rel_path;
sort_again = TRUE;
ui_breakcheck();
}
- vim_free(curdir);
+ free(curdir);
if (in_curdir != NULL) {
for (i = 0; i < gap->ga_len; i++)
- vim_free(in_curdir[i]);
- vim_free(in_curdir);
+ free(in_curdir[i]);
+ free(in_curdir);
}
ga_clear_strings(&path_ga);
vim_regfree(regmatch.regprog);
@@ -891,7 +891,7 @@ expand_in_path (
ga_init(&path_ga, (int)sizeof(char_u *), 1);
expand_path_option(curdir, &path_ga);
- vim_free(curdir);
+ free(curdir);
if (path_ga.ga_len == 0)
return 0;
@@ -899,7 +899,7 @@ expand_in_path (
ga_clear_strings(&path_ga);
files = globpath(paths, pattern, (flags & EW_ICASE) ? WILD_ICASE : 0);
- vim_free(paths);
+ free(paths);
if (files == NULL)
return 0;
@@ -919,7 +919,7 @@ expand_in_path (
s = e;
}
}
- vim_free(files);
+ free(files);
return gap->ga_len;
}
@@ -1046,7 +1046,7 @@ gen_expand_wildcards (
* found file names and start all over again.
*/
else if (has_env_var(p) || *p == '~') {
- vim_free(p);
+ free(p);
ga_clear_strings(&ga);
i = mch_expand_wildcards(num_pat, pat, num_file, file,
flags);
@@ -1090,13 +1090,13 @@ gen_expand_wildcards (
addfile(&ga, t, flags | EW_DIR | EW_FILE);
else if (os_file_exists(t))
addfile(&ga, t, flags);
- vim_free(t);
+ free(t);
}
if (did_expand_in_path && ga.ga_len > 0 && (flags & EW_PATH))
uniquefy_paths(&ga, p);
if (p != pat[i])
- vim_free(p);
+ free(p);
}
*num_file = ga.ga_len;
@@ -1144,7 +1144,7 @@ expand_backtick (
else
buffer = get_cmd_output(cmd, NULL,
(flags & EW_SILENT) ? kShellOptSilent : 0);
- vim_free(cmd);
+ free(cmd);
if (buffer == NULL)
return 0;
@@ -1167,7 +1167,7 @@ expand_backtick (
++cmd;
}
- vim_free(buffer);
+ free(buffer);
return cnt;
}
@@ -1462,13 +1462,13 @@ find_file_name_in_path (
/* Repeat finding the file "count" times. This matters when it
* appears several times in the path. */
while (file_name != NULL && --count > 0) {
- vim_free(file_name);
+ free(file_name);
file_name = find_file_in_path(ptr, len, options, FALSE, rel_fname);
}
} else
file_name = vim_strnsave(ptr, len);
- vim_free(tofree);
+ free(tofree);
return file_name;
}
@@ -1703,7 +1703,7 @@ char_u *path_shorten_fname_if_possible(char_u *full_path)
p = full_path;
}
}
- vim_free(dirname);
+ free(dirname);
return p;
}
@@ -1757,8 +1757,8 @@ expand_wildcards_eval (
ret = expand_wildcards(1, &exp_pat, num_file, file, flags);
if (eval_pat != NULL) {
- vim_free(exp_pat);
- vim_free(eval_pat);
+ free(exp_pat);
+ free(eval_pat);
}
return ret;
@@ -1802,13 +1802,13 @@ expand_wildcards (
break;
if (match_file_list(p_wig, (*file)[i], ffname)) {
/* remove this matching file from the list */
- vim_free((*file)[i]);
+ free((*file)[i]);
for (j = i; j + 1 < *num_file; ++j)
(*file)[j] = (*file)[j + 1];
--*num_file;
--i;
}
- vim_free(ffname);
+ free(ffname);
}
}
diff --git a/src/popupmnu.c b/src/popupmnu.c
index bfb6b693e1..b64f336d83 100644
--- a/src/popupmnu.c
+++ b/src/popupmnu.c
@@ -368,15 +368,15 @@ void pum_redraw(void)
}
screen_puts_len(rt, (int)STRLEN(rt), row, col - size + 1,
attr);
- vim_free(rt_start);
+ free(rt_start);
}
- vim_free(st);
+ free(st);
col -= width;
} else {
if (st != NULL) {
screen_puts_len(st, (int)STRLEN(st), row, col, attr);
- vim_free(st);
+ free(st);
}
col += width;
}
diff --git a/src/quickfix.c b/src/quickfix.c
index c98b43fff6..91ebe9795b 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -721,7 +721,7 @@ restofline:
len = (int)STRLEN(qfprev->qf_text);
ptr = alloc((unsigned)(len + STRLEN(errmsg) + 2));
STRCPY(ptr, qfprev->qf_text);
- vim_free(qfprev->qf_text);
+ free(qfprev->qf_text);
qfprev->qf_text = ptr;
*(ptr += len) = '\n';
STRCPY(++ptr, errmsg);
@@ -812,15 +812,15 @@ qf_init_ok:
for (fmt_ptr = fmt_first; fmt_ptr != NULL; fmt_ptr = fmt_first) {
fmt_first = fmt_ptr->next;
vim_regfree(fmt_ptr->prog);
- vim_free(fmt_ptr);
+ free(fmt_ptr);
}
qf_clean_dir_stack(&dir_stack);
qf_clean_dir_stack(&file_stack);
qf_init_end:
- vim_free(namebuf);
- vim_free(errmsg);
- vim_free(pattern);
- vim_free(fmtstr);
+ free(namebuf);
+ free(errmsg);
+ free(pattern);
+ free(fmtstr);
qf_update_buffer(qi);
@@ -880,7 +880,7 @@ static void ll_free_all(qf_info_T **pqi)
/* No references to this location list */
for (i = 0; i < qi->qf_listcount; ++i)
qf_free(qi, i);
- vim_free(qi);
+ free(qi);
}
}
@@ -929,7 +929,7 @@ qf_add_entry (
else
qfp->qf_fnum = qf_get_fnum(dir, fname);
if ((qfp->qf_text = vim_strsave(mesg)) == NULL) {
- vim_free(qfp);
+ free(qfp);
return FAIL;
}
qfp->qf_lnum = lnum;
@@ -938,8 +938,8 @@ qf_add_entry (
if (pattern == NULL || *pattern == NUL)
qfp->qf_pattern = NULL;
else if ((qfp->qf_pattern = vim_strsave(pattern)) == NULL) {
- vim_free(qfp->qf_text);
- vim_free(qfp);
+ free(qfp->qf_text);
+ free(qfp);
return FAIL;
}
qfp->qf_nr = nr;
@@ -1122,7 +1122,7 @@ static int qf_get_fnum(char_u *directory, char_u *fname)
* directory change.
*/
if (!os_file_exists(ptr)) {
- vim_free(ptr);
+ free(ptr);
directory = qf_guess_filepath(fname);
if (directory)
ptr = concat_fnames(directory, fname, TRUE);
@@ -1131,7 +1131,7 @@ static int qf_get_fnum(char_u *directory, char_u *fname)
}
/* Use concatenated directory name and file name */
fnum = buflist_add(ptr, 0);
- vim_free(ptr);
+ free(ptr);
return fnum;
}
return buflist_add(fname, 0);
@@ -1166,7 +1166,7 @@ static char_u *qf_push_dir(char_u *dirbuf, struct dir_stack_T **stackptr)
ds_new = (*stackptr)->next;
(*stackptr)->dirname = NULL;
while (ds_new) {
- vim_free((*stackptr)->dirname);
+ free((*stackptr)->dirname);
(*stackptr)->dirname = concat_fnames(ds_new->dirname, dirbuf,
TRUE);
if (os_isdir((*stackptr)->dirname))
@@ -1179,13 +1179,13 @@ static char_u *qf_push_dir(char_u *dirbuf, struct dir_stack_T **stackptr)
while ((*stackptr)->next != ds_new) {
ds_ptr = (*stackptr)->next;
(*stackptr)->next = (*stackptr)->next->next;
- vim_free(ds_ptr->dirname);
- vim_free(ds_ptr);
+ free(ds_ptr->dirname);
+ free(ds_ptr);
}
/* Nothing found -> it must be on top level */
if (ds_new == NULL) {
- vim_free((*stackptr)->dirname);
+ free((*stackptr)->dirname);
(*stackptr)->dirname = vim_strsave(dirbuf);
}
}
@@ -1195,7 +1195,7 @@ static char_u *qf_push_dir(char_u *dirbuf, struct dir_stack_T **stackptr)
else {
ds_ptr = *stackptr;
*stackptr = (*stackptr)->next;
- vim_free(ds_ptr);
+ free(ds_ptr);
return NULL;
}
}
@@ -1216,8 +1216,8 @@ static char_u *qf_pop_dir(struct dir_stack_T **stackptr)
if (*stackptr != NULL) {
ds_ptr = *stackptr;
*stackptr = (*stackptr)->next;
- vim_free(ds_ptr->dirname);
- vim_free(ds_ptr);
+ free(ds_ptr->dirname);
+ free(ds_ptr);
}
/* return NEW top element as current dir or NULL if stack is empty*/
@@ -1233,8 +1233,8 @@ static void qf_clean_dir_stack(struct dir_stack_T **stackptr)
while ((ds_ptr = *stackptr) != NULL) {
*stackptr = (*stackptr)->next;
- vim_free(ds_ptr->dirname);
- vim_free(ds_ptr);
+ free(ds_ptr->dirname);
+ free(ds_ptr);
}
}
@@ -1271,7 +1271,7 @@ static char_u *qf_guess_filepath(char_u *filename)
ds_ptr = dir_stack->next;
fullname = NULL;
while (ds_ptr) {
- vim_free(fullname);
+ free(fullname);
fullname = concat_fnames(ds_ptr->dirname, filename, TRUE);
if (os_file_exists(fullname))
@@ -1280,14 +1280,14 @@ static char_u *qf_guess_filepath(char_u *filename)
ds_ptr = ds_ptr->next;
}
- vim_free(fullname);
+ free(fullname);
/* clean up all dirs we already left */
while (dir_stack->next != ds_ptr) {
ds_tmp = dir_stack->next;
dir_stack->next = dir_stack->next->next;
- vim_free(ds_tmp->dirname);
- vim_free(ds_tmp);
+ free(ds_tmp->dirname);
+ free(ds_tmp);
}
return ds_ptr==NULL ? NULL : ds_ptr->dirname;
@@ -1904,10 +1904,10 @@ static void qf_free(qf_info_T *qi, int idx)
while (qi->qf_lists[idx].qf_count) {
qfp = qi->qf_lists[idx].qf_start->qf_next;
if (qi->qf_lists[idx].qf_title != NULL && !stop) {
- vim_free(qi->qf_lists[idx].qf_start->qf_text);
+ free(qi->qf_lists[idx].qf_start->qf_text);
stop = (qi->qf_lists[idx].qf_start == qfp);
- vim_free(qi->qf_lists[idx].qf_start->qf_pattern);
- vim_free(qi->qf_lists[idx].qf_start);
+ free(qi->qf_lists[idx].qf_start->qf_pattern);
+ free(qi->qf_lists[idx].qf_start);
if (stop)
/* Somehow qf_count may have an incorrect value, set it to 1
* to avoid crashing when it's wrong.
@@ -1917,7 +1917,7 @@ static void qf_free(qf_info_T *qi, int idx)
qi->qf_lists[idx].qf_start = qfp;
--qi->qf_lists[idx].qf_count;
}
- vim_free(qi->qf_lists[idx].qf_title);
+ free(qi->qf_lists[idx].qf_title);
qi->qf_lists[idx].qf_title = NULL;
}
@@ -2558,8 +2558,8 @@ void ex_make(exarg_T *eap)
qf_jump(qi, 0, 0, FALSE); /* display first error */
os_remove((char *)fname);
- vim_free(fname);
- vim_free(cmd);
+ free(fname);
+ free(cmd);
}
/*
@@ -2609,7 +2609,7 @@ static char_u *get_mef_name(void)
#endif
)
break;
- vim_free(name);
+ free(name);
}
return name;
}
@@ -2870,7 +2870,7 @@ void ex_vimgrep(exarg_T *eap)
msg_outtrans(fname);
else {
msg_outtrans(p);
- vim_free(p);
+ free(p);
}
msg_clr_eos();
msg_didout = FALSE; /* overwrite this message */
@@ -3057,9 +3057,9 @@ void ex_vimgrep(exarg_T *eap)
}
theend:
- vim_free(dirname_now);
- vim_free(dirname_start);
- vim_free(target_dir);
+ free(dirname_now);
+ free(dirname_start);
+ free(target_dir);
vim_regfree(regmatch.regprog);
}
@@ -3127,7 +3127,7 @@ static void restore_start_dir(char_u *dirname_start)
ea.cmdidx = (curwin->w_localdir == NULL) ? CMD_cd : CMD_lcd;
ex_cd(&ea);
}
- vim_free(dirname_now);
+ free(dirname_now);
}
/*
@@ -3391,10 +3391,10 @@ int set_errorlist(win_T *wp, list_T *list, int action, char_u *title)
type == NULL ? NUL : *type,
valid);
- vim_free(filename);
- vim_free(pattern);
- vim_free(text);
- vim_free(type);
+ free(filename);
+ free(pattern);
+ free(text);
+ free(type);
if (status == FAIL) {
retval = FAIL;
@@ -3631,12 +3631,12 @@ void ex_helpgrep(exarg_T *eap)
) == FAIL) {
got_int = TRUE;
if (line != IObuff)
- vim_free(line);
+ free(line);
break;
}
}
if (line != IObuff)
- vim_free(line);
+ free(line);
++lnum;
line_breakcheck();
}
diff --git a/src/regexp.c b/src/regexp.c
index d84536dafe..73226065d8 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -1173,7 +1173,7 @@ static void bt_regfree(regprog_T *prog);
* This also means that we don't allocate space until we are sure that the
* thing really will compile successfully, and we never have to move the
* code and thus invalidate pointers into it. (Note that it has to be in
- * one piece because vim_free() must be able to free it all.)
+ * one piece because free() must be able to free it all.)
*
* Whether upper/lower case is to be ignored is decided when executing the
* program, it does not matter here.
@@ -1220,7 +1220,7 @@ static regprog_T *bt_regcomp(char_u *expr, int re_flags)
regcode = r->program;
regc(REGMAGIC);
if (reg(REG_NOPAREN, &flags) == NULL || reg_toolong) {
- vim_free(r);
+ free(r);
if (reg_toolong)
EMSG_RET_NULL(_("E339: Pattern too long"));
return NULL;
@@ -1302,7 +1302,7 @@ static regprog_T *bt_regcomp(char_u *expr, int re_flags)
*/
static void bt_regfree(regprog_T *prog)
{
- vim_free(prog);
+ free(prog);
}
/*
@@ -3255,8 +3255,8 @@ void free_regexp_stuff(void)
{
ga_clear(&regstack);
ga_clear(&backpos);
- vim_free(reg_tofree);
- vim_free(reg_prev_sub);
+ free(reg_tofree);
+ free(reg_prev_sub);
}
#endif
@@ -3533,7 +3533,7 @@ theend:
/* Free "reg_tofree" when it's a bit big.
* Free regstack and backpos if they are bigger than their initial size. */
if (reg_tofreelen > 400) {
- vim_free(reg_tofree);
+ free(reg_tofree);
reg_tofree = NULL;
}
if (regstack.ga_maxlen > REGSTACK_INITIAL)
@@ -3576,8 +3576,8 @@ void unref_extmatch(reg_extmatch_T *em)
if (em != NULL && --em->refcnt <= 0) {
for (i = 0; i < NSUBEXP; ++i)
- vim_free(em->matches[i]);
- vim_free(em);
+ free(em->matches[i]);
+ free(em);
}
}
@@ -5653,7 +5653,7 @@ static int match_with_backref(linenr_T start_lnum, colnr_T start_col, linenr_T e
len = (int)STRLEN(regline);
if (reg_tofree == NULL || len >= (int)reg_tofreelen) {
len += 50; /* get some extra */
- vim_free(reg_tofree);
+ free(reg_tofree);
reg_tofree = alloc(len);
reg_tofreelen = len;
}
@@ -6417,7 +6417,7 @@ char_u *regtilde(char_u *source, int magic)
STRCPY(tmpsub + len + prevlen, p + 1);
if (newsub != source) /* already allocated newsub */
- vim_free(newsub);
+ free(newsub);
newsub = tmpsub;
p = newsub + len + prevlen;
} else if (magic)
@@ -6433,7 +6433,7 @@ char_u *regtilde(char_u *source, int magic)
}
}
- vim_free(reg_prev_sub);
+ free(reg_prev_sub);
if (newsub != source) /* newsub was allocated, just keep it */
reg_prev_sub = newsub;
else /* no ~ found, need to save newsub */
@@ -6529,14 +6529,14 @@ static int vim_regsub_both(char_u *source, char_u *dest, int copy, int magic, in
if (eval_result != NULL) {
STRCPY(dest, eval_result);
dst += STRLEN(eval_result);
- vim_free(eval_result);
+ free(eval_result);
eval_result = NULL;
}
} else {
win_T *save_reg_win;
int save_ireg_ic;
- vim_free(eval_result);
+ free(eval_result);
/* The expression may contain substitute(), which calls us
* recursively. Make sure submatch() gets the text from the first
@@ -6578,7 +6578,7 @@ static int vim_regsub_both(char_u *source, char_u *dest, int copy, int magic, in
/* Backslashes will be consumed, need to double them. */
s = vim_strsave_escaped(eval_result, (char_u *)"\\");
if (s != NULL) {
- vim_free(eval_result);
+ free(eval_result);
eval_result = s;
}
}
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
index 52dc228bb2..a9960cbae0 100644
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -3311,7 +3311,7 @@ static nfa_state_T *post2nfa(int *postfix, int *end, int nfa_calc_size)
ret = e.start;
theend:
- vim_free(stack);
+ free(stack);
return ret;
#undef POP1
@@ -4207,7 +4207,7 @@ addstate_here (
memmove(&(newl[listidx + count]),
&(l->t[listidx + 1]),
sizeof(nfa_thread_T) * (l->n - count - listidx - 1));
- vim_free(l->t);
+ free(l->t);
l->t = newl;
} else {
/* make space for new states, then move them from the
@@ -6009,9 +6009,9 @@ nextchar:
#endif
/* Free memory */
- vim_free(list[0].t);
- vim_free(list[1].t);
- vim_free(listids);
+ free(list[0].t);
+ free(list[1].t);
+ free(listids);
#undef ADD_STATE_IF_MATCH
#ifdef NFA_REGEXP_DEBUG_LOG
fclose(debug);
@@ -6321,13 +6321,13 @@ static regprog_T *nfa_regcomp(char_u *expr, int re_flags)
#endif
out:
- vim_free(post_start);
+ free(post_start);
post_start = post_ptr = post_end = NULL;
state_ptr = NULL;
return (regprog_T *)prog;
fail:
- vim_free(prog);
+ free(prog);
prog = NULL;
#ifdef ENABLE_LOG
nfa_postfix_dump(expr, FAIL);
@@ -6344,11 +6344,11 @@ fail:
static void nfa_regfree(regprog_T *prog)
{
if (prog != NULL) {
- vim_free(((nfa_regprog_T *)prog)->match_text);
+ free(((nfa_regprog_T *)prog)->match_text);
#ifdef REGEXP_DEBUG
- vim_free(((nfa_regprog_T *)prog)->pattern);
+ free(((nfa_regprog_T *)prog)->pattern);
#endif
- vim_free(prog);
+ free(prog);
}
}
diff --git a/src/screen.c b/src/screen.c
index 9910f93324..794b35bef7 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -362,15 +362,15 @@ int redraw_asap(int type)
ret = 4;
}
- vim_free(screenline);
- vim_free(screenattr);
+ free(screenline);
+ free(screenattr);
if (enc_utf8) {
- vim_free(screenlineUC);
+ free(screenlineUC);
for (i = 0; i < p_mco; ++i)
- vim_free(screenlineC[i]);
+ free(screenlineC[i]);
}
if (enc_dbcs == DBCS_JPNU)
- vim_free(screenline2);
+ free(screenline2);
/* Show the intro message when appropriate. */
maybe_intro_message();
@@ -2068,7 +2068,7 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T
}
if (text != buf)
- vim_free(text);
+ free(text);
/*
* 6. set highlighting for the Visual area an other text.
@@ -4836,7 +4836,7 @@ win_redr_status_matches (
}
win_redraw_last_status(topframe);
- vim_free(buf);
+ free(buf);
}
/*
@@ -5051,7 +5051,7 @@ get_keymap_str (
sprintf((char *)buf, "<%s>", p);
else
buf[0] = NUL;
- vim_free(s);
+ free(s);
}
return buf[0] != NUL;
}
@@ -5157,13 +5157,13 @@ win_redr_custom (
width = build_stl_str_hl(ewp, buf, sizeof(buf),
stl, use_sandbox,
fillchar, maxwidth, hltab, tabtab);
- vim_free(stl);
+ free(stl);
ewp->w_p_crb = p_crb_save;
/* Make all characters printable. */
p = transstr(buf);
vim_strncpy(buf, p, sizeof(buf) - 1);
- vim_free(p);
+ free(p);
/* fill up with "fillchar" */
len = (int)STRLEN(buf);
@@ -6304,23 +6304,23 @@ retry:
* and over again. */
done_outofmem_msg = TRUE;
}
- vim_free(new_ScreenLines);
+ free(new_ScreenLines);
new_ScreenLines = NULL;
- vim_free(new_ScreenLinesUC);
+ free(new_ScreenLinesUC);
new_ScreenLinesUC = NULL;
for (i = 0; i < p_mco; ++i) {
- vim_free(new_ScreenLinesC[i]);
+ free(new_ScreenLinesC[i]);
new_ScreenLinesC[i] = NULL;
}
- vim_free(new_ScreenLines2);
+ free(new_ScreenLines2);
new_ScreenLines2 = NULL;
- vim_free(new_ScreenAttrs);
+ free(new_ScreenAttrs);
new_ScreenAttrs = NULL;
- vim_free(new_LineOffset);
+ free(new_LineOffset);
new_LineOffset = NULL;
- vim_free(new_LineWraps);
+ free(new_LineWraps);
new_LineWraps = NULL;
- vim_free(new_TabPageIdxs);
+ free(new_TabPageIdxs);
new_TabPageIdxs = NULL;
} else {
done_outofmem_msg = FALSE;
@@ -6431,15 +6431,15 @@ void free_screenlines(void)
{
int i;
- vim_free(ScreenLinesUC);
+ free(ScreenLinesUC);
for (i = 0; i < Screen_mco; ++i)
- vim_free(ScreenLinesC[i]);
- vim_free(ScreenLines2);
- vim_free(ScreenLines);
- vim_free(ScreenAttrs);
- vim_free(LineOffset);
- vim_free(LineWraps);
- vim_free(TabPageIdxs);
+ free(ScreenLinesC[i]);
+ free(ScreenLines2);
+ free(ScreenLines);
+ free(ScreenAttrs);
+ free(LineOffset);
+ free(LineWraps);
+ free(TabPageIdxs);
}
void screenclear(void)
diff --git a/src/search.c b/src/search.c
index 2c33c3f6ab..3d153c433c 100644
--- a/src/search.c
+++ b/src/search.c
@@ -181,7 +181,7 @@ search_regcomp (
add_to_history(HIST_SEARCH, pat, TRUE, NUL);
if (mr_pattern_alloced) {
- vim_free(mr_pattern);
+ free(mr_pattern);
mr_pattern_alloced = FALSE;
}
@@ -264,7 +264,7 @@ char_u *reverse_text(char_u *s)
static void save_re_pat(int idx, char_u *pat, int magic)
{
if (spats[idx].pat != pat) {
- vim_free(spats[idx].pat);
+ free(spats[idx].pat);
spats[idx].pat = vim_strsave(pat);
spats[idx].magic = magic;
spats[idx].no_scs = no_smartcase;
@@ -299,10 +299,10 @@ void save_search_patterns(void)
void restore_search_patterns(void)
{
if (--save_level == 0) {
- vim_free(spats[0].pat);
+ free(spats[0].pat);
spats[0] = saved_spats[0];
set_vv_searchforward();
- vim_free(spats[1].pat);
+ free(spats[1].pat);
spats[1] = saved_spats[1];
last_idx = saved_last_idx;
SET_NO_HLSEARCH(saved_no_hlsearch);
@@ -312,11 +312,11 @@ void restore_search_patterns(void)
#if defined(EXITFREE) || defined(PROTO)
void free_search_patterns(void)
{
- vim_free(spats[0].pat);
- vim_free(spats[1].pat);
+ free(spats[0].pat);
+ free(spats[1].pat);
if (mr_pattern_alloced) {
- vim_free(mr_pattern);
+ free(mr_pattern);
mr_pattern_alloced = FALSE;
mr_pattern = NULL;
}
@@ -392,7 +392,7 @@ void reset_search_dir(void)
*/
void set_last_search_pat(char_u *s, int idx, int magic, int setlast)
{
- vim_free(spats[idx].pat);
+ free(spats[idx].pat);
/* An empty string means that nothing should be matched. */
if (*s == NUL)
spats[idx].pat = NULL;
@@ -408,7 +408,7 @@ void set_last_search_pat(char_u *s, int idx, int magic, int setlast)
if (setlast)
last_idx = idx;
if (save_level) {
- vim_free(saved_spats[idx].pat);
+ free(saved_spats[idx].pat);
saved_spats[idx] = spats[0];
if (spats[idx].pat == NULL)
saved_spats[idx].pat = NULL;
@@ -1091,18 +1091,18 @@ proftime_T *tm; /* timeout limit or NULL */
r = reverse_text(trunc != NULL ? trunc : msgbuf);
if (r != NULL) {
- vim_free(trunc);
+ free(trunc);
trunc = r;
}
}
if (trunc != NULL) {
msg_outtrans(trunc);
- vim_free(trunc);
+ free(trunc);
} else
msg_outtrans(msgbuf);
msg_clr_eos();
msg_check();
- vim_free(msgbuf);
+ free(msgbuf);
gotocmdline(FALSE);
out_flush();
@@ -1220,7 +1220,7 @@ proftime_T *tm; /* timeout limit or NULL */
end_do_search:
if ((options & SEARCH_KEEP) || cmdmod.keeppatterns)
spats[0].off = old_off;
- vim_free(strcopy);
+ free(strcopy);
return retval;
}
@@ -3259,8 +3259,8 @@ again:
spat = alloc(len + 31);
epat = alloc(len + 9);
if (spat == NULL || epat == NULL) {
- vim_free(spat);
- vim_free(epat);
+ free(spat);
+ free(epat);
curwin->w_cursor = old_pos;
goto theend;
}
@@ -3270,8 +3270,8 @@ again:
r = do_searchpair(spat, (char_u *)"", epat, FORWARD, (char_u *)"",
0, NULL, (linenr_T)0, 0L);
- vim_free(spat);
- vim_free(epat);
+ free(spat);
+ free(epat);
if (r < 1 || lt(curwin->w_cursor, old_end)) {
/* Can't find other end or it's before the previous end. Could be a
@@ -4039,7 +4039,7 @@ find_pattern_in_path (
/* ignore case according to p_ic, p_scs and pat */
regmatch.rm_ic = ignorecase(pat);
regmatch.regprog = vim_regcomp(pat, p_magic ? RE_MAGIC : 0);
- vim_free(pat);
+ free(pat);
if (regmatch.regprog == NULL)
goto fpip_end;
}
@@ -4105,7 +4105,7 @@ find_pattern_in_path (
prev_fname = NULL;
}
}
- vim_free(new_fname);
+ free(new_fname);
new_fname = NULL;
already_searched = TRUE;
break;
@@ -4209,19 +4209,19 @@ find_pattern_in_path (
bigger[i + max_path_depth] = files[i];
old_files += max_path_depth;
max_path_depth *= 2;
- vim_free(files);
+ free(files);
files = bigger;
}
if ((files[depth + 1].fp = mch_fopen((char *)new_fname, "r"))
== NULL)
- vim_free(new_fname);
+ free(new_fname);
else {
if (++depth == old_files) {
/*
* lalloc() for 'bigger' must have failed above. We
* will forget one of our already visited files now.
*/
- vim_free(files[old_files].name);
+ free(files[old_files].name);
++old_files;
}
files[depth].name = curr_fname = new_fname;
@@ -4527,11 +4527,11 @@ exit_matched:
/* Close any files that are still open. */
for (i = 0; i <= depth; i++) {
fclose(files[i].fp);
- vim_free(files[i].name);
+ free(files[i].name);
}
for (i = old_files; i < max_path_depth; i++)
- vim_free(files[i].name);
- vim_free(files);
+ free(files[i].name);
+ free(files);
if (type == CHECK_PATH) {
if (!did_show) {
@@ -4554,7 +4554,7 @@ exit_matched:
msg_end();
fpip_end:
- vim_free(file_line);
+ free(file_line);
vim_regfree(regmatch.regprog);
vim_regfree(incl_regmatch.regprog);
vim_regfree(def_regmatch.regprog);
@@ -4667,7 +4667,7 @@ int read_viminfo_search_pattern(vir_T *virp, int force)
TRUE);
if (val != NULL) {
set_last_search_pat(val, idx, magic, setlast);
- vim_free(val);
+ free(val);
spats[idx].no_scs = no_scs;
spats[idx].off.line = off_line;
spats[idx].off.end = off_end;
diff --git a/src/spell.c b/src/spell.c
index b2eb178e0d..f06a1ccd04 100644
--- a/src/spell.c
+++ b/src/spell.c
@@ -2007,7 +2007,7 @@ spell_move_to (
len = (int)STRLEN(line);
if (buflen < len + MAXWLEN + 2) {
- vim_free(buf);
+ free(buf);
buflen = len + MAXWLEN + 2;
buf = alloc(buflen);
}
@@ -2081,7 +2081,7 @@ spell_move_to (
if (dir == FORWARD) {
// No need to search further.
wp->w_cursor = found_pos;
- vim_free(buf);
+ free(buf);
if (attrp != NULL)
*attrp = attr;
return len;
@@ -2104,7 +2104,7 @@ spell_move_to (
if (dir == BACKWARD && found_pos.lnum != 0) {
// Use the last match in the line (before the cursor).
wp->w_cursor = found_pos;
- vim_free(buf);
+ free(buf);
return found_len;
}
@@ -2168,7 +2168,7 @@ spell_move_to (
line_breakcheck();
}
- vim_free(buf);
+ free(buf);
return 0;
}
@@ -2292,10 +2292,10 @@ static slang_T *slang_alloc(char_u *lang)
// Free the contents of an slang_T and the structure itself.
static void slang_free(slang_T *lp)
{
- vim_free(lp->sl_name);
- vim_free(lp->sl_fname);
+ free(lp->sl_name);
+ free(lp->sl_fname);
slang_clear(lp);
- vim_free(lp);
+ free(lp);
}
// Clear an slang_T so that the file can be reloaded.
@@ -2307,26 +2307,26 @@ static void slang_clear(slang_T *lp)
int i;
int round;
- vim_free(lp->sl_fbyts);
+ free(lp->sl_fbyts);
lp->sl_fbyts = NULL;
- vim_free(lp->sl_kbyts);
+ free(lp->sl_kbyts);
lp->sl_kbyts = NULL;
- vim_free(lp->sl_pbyts);
+ free(lp->sl_pbyts);
lp->sl_pbyts = NULL;
- vim_free(lp->sl_fidxs);
+ free(lp->sl_fidxs);
lp->sl_fidxs = NULL;
- vim_free(lp->sl_kidxs);
+ free(lp->sl_kidxs);
lp->sl_kidxs = NULL;
- vim_free(lp->sl_pidxs);
+ free(lp->sl_pidxs);
lp->sl_pidxs = NULL;
for (round = 1; round <= 2; ++round) {
gap = round == 1 ? &lp->sl_rep : &lp->sl_repsal;
while (gap->ga_len > 0) {
ftp = &((fromto_T *)gap->ga_data)[--gap->ga_len];
- vim_free(ftp->ft_from);
- vim_free(ftp->ft_to);
+ free(ftp->ft_from);
+ free(ftp->ft_to);
}
ga_clear(gap);
}
@@ -2337,42 +2337,42 @@ static void slang_clear(slang_T *lp)
if (gap->ga_data != NULL)
// SOFOFROM and SOFOTO items: free lists of wide characters.
for (i = 0; i < gap->ga_len; ++i)
- vim_free(((int **)gap->ga_data)[i]);
+ free(((int **)gap->ga_data)[i]);
} else
// SAL items: free salitem_T items
while (gap->ga_len > 0) {
smp = &((salitem_T *)gap->ga_data)[--gap->ga_len];
- vim_free(smp->sm_lead);
+ free(smp->sm_lead);
// Don't free sm_oneof and sm_rules, they point into sm_lead.
- vim_free(smp->sm_to);
- vim_free(smp->sm_lead_w);
- vim_free(smp->sm_oneof_w);
- vim_free(smp->sm_to_w);
+ free(smp->sm_to);
+ free(smp->sm_lead_w);
+ free(smp->sm_oneof_w);
+ free(smp->sm_to_w);
}
ga_clear(gap);
for (i = 0; i < lp->sl_prefixcnt; ++i)
vim_regfree(lp->sl_prefprog[i]);
lp->sl_prefixcnt = 0;
- vim_free(lp->sl_prefprog);
+ free(lp->sl_prefprog);
lp->sl_prefprog = NULL;
- vim_free(lp->sl_info);
+ free(lp->sl_info);
lp->sl_info = NULL;
- vim_free(lp->sl_midword);
+ free(lp->sl_midword);
lp->sl_midword = NULL;
vim_regfree(lp->sl_compprog);
- vim_free(lp->sl_comprules);
- vim_free(lp->sl_compstartflags);
- vim_free(lp->sl_compallflags);
+ free(lp->sl_comprules);
+ free(lp->sl_compstartflags);
+ free(lp->sl_compallflags);
lp->sl_compprog = NULL;
lp->sl_comprules = NULL;
lp->sl_compstartflags = NULL;
lp->sl_compallflags = NULL;
- vim_free(lp->sl_syllable);
+ free(lp->sl_syllable);
lp->sl_syllable = NULL;
ga_clear(&lp->sl_syl_items);
@@ -2395,9 +2395,9 @@ static void slang_clear(slang_T *lp)
// Clear the info from the .sug file in "lp".
static void slang_clear_sug(slang_T *lp)
{
- vim_free(lp->sl_sbyts);
+ free(lp->sl_sbyts);
lp->sl_sbyts = NULL;
- vim_free(lp->sl_sidxs);
+ free(lp->sl_sidxs);
lp->sl_sidxs = NULL;
close_spellbuf(lp->sl_sugbuf);
lp->sl_sugbuf = NULL;
@@ -2565,7 +2565,7 @@ spell_load_file (
if (p == NULL)
goto endFAIL;
set_map_str(lp, p);
- vim_free(p);
+ free(p);
break;
case SN_WORDS:
@@ -2722,7 +2722,7 @@ static int read_charflags_section(FILE *fd)
// <folcharslen> <folchars>
fol = read_cnt_string(fd, 2, &follen);
if (follen < 0) {
- vim_free(flags);
+ free(flags);
return follen;
}
@@ -2730,8 +2730,8 @@ static int read_charflags_section(FILE *fd)
if (flags != NULL && fol != NULL)
set_spell_charflags(flags, flagslen, fol);
- vim_free(flags);
- vim_free(fol);
+ free(flags);
+ free(fol);
// When <charflagslen> is zero then <fcharlen> must also be zero.
if ((flags == NULL) != (fol == NULL))
@@ -2801,7 +2801,7 @@ static int read_rep_section(FILE *fd, garray_T *gap, short *first)
return SP_FORMERROR;
ftp->ft_to = read_cnt_string(fd, 1, &i);
if (i <= 0) {
- vim_free(ftp->ft_from);
+ free(ftp->ft_from);
if (i < 0)
return i;
return SP_FORMERROR;
@@ -2895,7 +2895,7 @@ static int read_sal_section(FILE *fd, slang_T *slang)
// <saltolen> <salto>
smp->sm_to = read_cnt_string(fd, 1, &ccnt);
if (ccnt < 0) {
- vim_free(smp->sm_lead);
+ free(smp->sm_lead);
return ccnt;
}
@@ -3058,7 +3058,7 @@ static int read_sofo_section(FILE *fd, slang_T *slang)
// <sofotolen> <sofoto>
to = read_cnt_string(fd, 2, &cnt);
if (cnt < 0) {
- vim_free(from);
+ free(from);
return cnt;
}
@@ -3070,8 +3070,8 @@ static int read_sofo_section(FILE *fd, slang_T *slang)
else
res = 0;
- vim_free(from);
- vim_free(to);
+ free(from);
+ free(to);
return res;
}
@@ -3172,7 +3172,7 @@ static int read_compound(FILE *fd, slang_T *slang, int len)
while (todo-- > 0) {
c = getc(fd); // <compflags>
if (c == EOF) {
- vim_free(pat);
+ free(pat);
return SP_TRUNCERROR;
}
@@ -3203,7 +3203,7 @@ static int read_compound(FILE *fd, slang_T *slang, int len)
// Copy flag to "sl_comprules", unless we run into a wildcard.
if (crp != NULL) {
if (c == '?' || c == '+' || c == '*') {
- vim_free(slang->sl_comprules);
+ free(slang->sl_comprules);
slang->sl_comprules = NULL;
crp = NULL;
} else
@@ -3233,7 +3233,7 @@ static int read_compound(FILE *fd, slang_T *slang, int len)
*crp = NUL;
slang->sl_compprog = vim_regcomp(pat, RE_MAGIC + RE_STRING + RE_STRICT);
- vim_free(pat);
+ free(pat);
if (slang->sl_compprog == NULL)
return SP_FORMERROR;
@@ -3898,7 +3898,7 @@ char_u *did_set_spelllang(win_T *wp)
}
theend:
- vim_free(spl_copy);
+ free(spl_copy);
recursive = FALSE;
return ret_msg;
}
@@ -3907,7 +3907,7 @@ theend:
static void clear_midword(win_T *wp)
{
memset(wp->w_s->b_spell_ismw, 0, 256);
- vim_free(wp->w_s->b_spell_ismw_mb);
+ free(wp->w_s->b_spell_ismw_mb);
wp->w_s->b_spell_ismw_mb = NULL;
}
@@ -3937,7 +3937,7 @@ static void use_midword(slang_T *lp, win_T *wp)
n = (int)STRLEN(wp->w_s->b_spell_ismw_mb);
bp = vim_strnsave(wp->w_s->b_spell_ismw_mb, n + l);
if (bp != NULL) {
- vim_free(wp->w_s->b_spell_ismw_mb);
+ free(wp->w_s->b_spell_ismw_mb);
wp->w_s->b_spell_ismw_mb = bp;
vim_strncpy(bp + n, p, l);
}
@@ -4062,7 +4062,7 @@ void spell_delete_wordlist(void)
os_remove((char *)int_wordlist);
int_wordlist_spl(fname);
os_remove((char *)fname);
- vim_free(int_wordlist);
+ free(int_wordlist);
int_wordlist = NULL;
}
}
@@ -4085,9 +4085,9 @@ void spell_free_all(void)
spell_delete_wordlist();
- vim_free(repl_to);
+ free(repl_to);
repl_to = NULL;
- vim_free(repl_from);
+ free(repl_from);
repl_from = NULL;
}
@@ -4588,7 +4588,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
continue;
// Convert from "SET" to 'encoding' when needed.
- vim_free(pc);
+ free(pc);
if (spin->si_conv.vc_type != CONV_NONE) {
pc = string_convert(&spin->si_conv, rline, NULL);
if (pc == NULL) {
@@ -5207,9 +5207,9 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
(void)set_spell_chartab(fol, low, upp);
}
- vim_free(fol);
- vim_free(low);
- vim_free(upp);
+ free(fol);
+ free(low);
+ free(upp);
}
// Use compound specifications of the .aff file for the spell info.
@@ -5272,7 +5272,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
spin->si_midword = midword;
}
- vim_free(pc);
+ free(pc);
fclose(fd);
return aff;
}
@@ -5549,7 +5549,7 @@ static void spell_free_aff(afffile_T *aff)
affheader_T *ah;
affentry_T *ae;
- vim_free(aff->af_enc);
+ free(aff->af_enc);
// All this trouble to free the "ae_prog" items...
for (ht = &aff->af_pref;; ht = &aff->af_suff) {
@@ -5666,7 +5666,7 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
// Skip non-ASCII words when "spin->si_ascii" is TRUE.
if (spin->si_ascii && has_non_ascii(w)) {
++non_ascii;
- vim_free(pc);
+ free(pc);
continue;
}
@@ -5688,7 +5688,7 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
dw = (char_u *)getroom_save(spin, w);
if (dw == NULL) {
retval = FAIL;
- vim_free(pc);
+ free(pc);
break;
}
@@ -5747,7 +5747,7 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
retval = FAIL;
}
- vim_free(pc);
+ free(pc);
}
if (duplicate > 0)
@@ -6141,7 +6141,7 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
rline[l] = NUL;
// Convert from "/encoding={encoding}" to 'encoding' when needed.
- vim_free(pc);
+ free(pc);
if (spin->si_conv.vc_type != CONV_NONE) {
pc = string_convert(&spin->si_conv, rline, NULL);
if (pc == NULL) {
@@ -6177,7 +6177,7 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
p_enc) == FAIL)
smsg((char_u *)_("Conversion in %s not supported: from %s to %s"),
fname, line, p_enc);
- vim_free(enc);
+ free(enc);
spin->si_conv.vc_fail = true;
}
continue;
@@ -6257,7 +6257,7 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
did_word = TRUE;
}
- vim_free(pc);
+ free(pc);
fclose(fd);
if (spin->si_ascii && non_ascii > 0) {
@@ -6328,7 +6328,7 @@ static void free_blocks(sblock_T *bl)
while (bl != NULL) {
next = bl->sb_next;
- vim_free(bl);
+ free(bl);
bl = next;
}
}
@@ -7390,7 +7390,7 @@ static void spell_make_sugfile(spellinfo_T *spin, char_u *wfname)
sug_write(spin, fname);
theend:
- vim_free(fname);
+ free(fname);
if (free_slang)
slang_free(slang);
free_blocks(spin->si_blocks);
@@ -7743,7 +7743,7 @@ static void close_spellbuf(buf_T *buf)
{
if (buf != NULL) {
ml_close(buf, TRUE);
- vim_free(buf);
+ free(buf);
}
}
@@ -7967,8 +7967,8 @@ mkspell (
}
theend:
- vim_free(fname);
- vim_free(wfname);
+ free(fname);
+ free(wfname);
}
// Display a message for spell file processing when 'verbose' is set or using
@@ -8042,7 +8042,7 @@ spell_add_word (
break;
if (*spf == NUL) {
EMSGN(_("E765: 'spellfile' does not have %" PRId64 " entries"), idx);
- vim_free(fnamebuf);
+ free(fnamebuf);
return;
}
}
@@ -8053,7 +8053,7 @@ spell_add_word (
buf = NULL;
if (buf != NULL && bufIsChanged(buf)) {
EMSG(_(e_bufloaded));
- vim_free(fnamebuf);
+ free(fnamebuf);
return;
}
@@ -8138,7 +8138,7 @@ spell_add_word (
redraw_all_later(SOME_VALID);
}
- vim_free(fnamebuf);
+ free(fnamebuf);
}
// Initialize 'spellfile' for the current buffer.
@@ -8207,7 +8207,7 @@ static void init_spellfile(void)
aspath = FALSE;
}
- vim_free(buf);
+ free(buf);
}
}
@@ -8699,9 +8699,9 @@ void spell_suggest(int count)
smsg((char_u *)_("Sorry, only %" PRId64 " suggestions"),
(int64_t)sug.su_ga.ga_len);
} else {
- vim_free(repl_from);
+ free(repl_from);
repl_from = NULL;
- vim_free(repl_to);
+ free(repl_to);
repl_to = NULL;
// When 'rightleft' is set the list is drawn right-left.
@@ -8821,7 +8821,7 @@ void spell_suggest(int count)
spell_find_cleanup(&sug);
skip:
- vim_free(line);
+ free(line);
}
// Check if the word at line "lnum" column "col" is required to start with a
@@ -8876,7 +8876,7 @@ static int check_need_cap(linenr_T lnum, colnr_T col)
}
}
- vim_free(line_copy);
+ free(line_copy);
return need_cap;
}
@@ -8934,7 +8934,7 @@ void ex_spellrepall(exarg_T *eap)
p_ws = save_ws;
curwin->w_cursor = pos;
- vim_free(frompat);
+ free(frompat);
if (sub_nsubs == 0)
EMSG2(_("E753: Not found: %s"), repl_from);
@@ -9091,7 +9091,7 @@ spell_find_suggest (
}
}
- vim_free(sps_copy);
+ free(sps_copy);
if (do_combine)
// Combine the two list of suggestions. This must be done last,
@@ -9429,10 +9429,10 @@ static void spell_find_cleanup(suginfo_T *su)
// Free the suggestions.
for (i = 0; i < su->su_ga.ga_len; ++i)
- vim_free(SUG(su->su_ga, i).st_word);
+ free(SUG(su->su_ga, i).st_word);
ga_clear(&su->su_ga);
for (i = 0; i < su->su_sga.ga_len; ++i)
- vim_free(SUG(su->su_sga, i).st_word);
+ free(SUG(su->su_sga, i).st_word);
ga_clear(&su->su_sga);
// Free the banned words.
@@ -11121,7 +11121,7 @@ static void score_combine(suginfo_T *su)
if (j == ga.ga_len)
stp[ga.ga_len++] = SUG(*gap, i);
else
- vim_free(p);
+ free(p);
}
}
}
@@ -11132,7 +11132,7 @@ static void score_combine(suginfo_T *su)
// Truncate the list to the number of suggestions that will be displayed.
if (ga.ga_len > su->su_maxcount) {
for (i = su->su_maxcount; i < ga.ga_len; ++i)
- vim_free(stp[i].st_word);
+ free(stp[i].st_word);
ga.ga_len = su->su_maxcount;
}
@@ -11268,7 +11268,7 @@ static void suggest_try_soundalike_finish(void)
todo = (int)slang->sl_sounddone.ht_used;
for (hi = slang->sl_sounddone.ht_array; todo > 0; ++hi)
if (!HASHITEM_EMPTY(hi)) {
- vim_free(HI2SFT(hi));
+ free(HI2SFT(hi));
--todo;
}
@@ -11593,7 +11593,7 @@ static void set_map_str(slang_T *lp, char_u *map)
// This should have been checked when generating the .spl
// file.
EMSG(_("E783: duplicate char in MAP entry"));
- vim_free(b);
+ free(b);
}
} else
lp->sl_map_array[c] = headc;
@@ -11780,7 +11780,7 @@ check_suggestions (
(void)spell_check(curwin, longword, &attr, NULL, FALSE);
if (attr != HLF_COUNT) {
// Remove this entry.
- vim_free(stp[i].st_word);
+ free(stp[i].st_word);
--gap->ga_len;
if (i < gap->ga_len)
memmove(stp + i, stp + i + 1,
@@ -11881,7 +11881,7 @@ cleanup_suggestions (
// Truncate the list to the number of suggestions that will be displayed.
if (gap->ga_len > keep) {
for (i = keep; i < gap->ga_len; ++i)
- vim_free(stp[i].st_word);
+ free(stp[i].st_word);
gap->ga_len = keep;
return stp[keep - 1].st_score;
}
@@ -12820,7 +12820,7 @@ static int spell_edit_score(slang_T *slang, char_u *badword, char_u *goodword)
}
i = CNT(badlen - 1, goodlen - 1);
- vim_free(cnt);
+ free(cnt);
return i;
}
@@ -13185,7 +13185,7 @@ void ex_spelldump(exarg_T *eap)
// enable spelling locally in the new window
set_option_value((char_u*)"spell", TRUE, (char_u*)"", OPT_LOCAL);
set_option_value((char_u*)"spl", dummy, spl, OPT_LOCAL);
- vim_free(spl);
+ free(spl);
if (!bufempty() || !buf_valid(curbuf))
return;
diff --git a/src/strings.c b/src/strings.c
index 87d5cc37c5..72a1f11460 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -284,7 +284,7 @@ char_u *strup_save(char_u *orig)
memmove(s, res, p - res);
STRCPY(s + (p - res) + newl, p + l);
p = s + (p - res);
- vim_free(res);
+ free(res);
res = s;
}
diff --git a/src/syntax.c b/src/syntax.c
index e05a4d1bfb..41128868fc 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -1065,7 +1065,7 @@ static void syn_stack_free_block(synblock_T *block)
if (block->b_sst_array != NULL) {
for (p = block->b_sst_first; p != NULL; p = p->sst_next)
clear_syn_state(p);
- vim_free(block->b_sst_array);
+ free(block->b_sst_array);
block->b_sst_array = NULL;
block->b_sst_len = 0;
}
@@ -1153,7 +1153,7 @@ static void syn_stack_alloc(void)
to->sst_next = to + 1;
(sstp + len - 1)->sst_next = NULL;
- vim_free(syn_block->b_sst_array);
+ free(syn_block->b_sst_array);
syn_block->b_sst_array = sstp;
syn_block->b_sst_len = len;
}
@@ -3161,7 +3161,7 @@ void syntax_clear(synblock_T *block)
vim_regfree(block->b_syn_linecont_prog);
block->b_syn_linecont_prog = NULL;
- vim_free(block->b_syn_linecont_pat);
+ free(block->b_syn_linecont_pat);
block->b_syn_linecont_pat = NULL;
block->b_syn_folditems = 0;
@@ -3180,7 +3180,7 @@ void reset_synblock(win_T *wp)
{
if (wp->w_s != &wp->w_buffer->b_s) {
syntax_clear(wp->w_s);
- vim_free(wp->w_s);
+ free(wp->w_s);
wp->w_s = &wp->w_buffer->b_s;
}
}
@@ -3204,7 +3204,7 @@ static void syntax_sync_clear(void)
vim_regfree(curwin->w_s->b_syn_linecont_prog);
curwin->w_s->b_syn_linecont_prog = NULL;
- vim_free(curwin->w_s->b_syn_linecont_pat);
+ free(curwin->w_s->b_syn_linecont_pat);
curwin->w_s->b_syn_linecont_pat = NULL;
syn_stack_free_all(curwin->w_s); /* Need to recompute all syntax. */
@@ -3232,13 +3232,13 @@ static void syn_remove_pattern(synblock_T *block, int idx)
*/
static void syn_clear_pattern(synblock_T *block, int i)
{
- vim_free(SYN_ITEMS(block)[i].sp_pattern);
+ free(SYN_ITEMS(block)[i].sp_pattern);
vim_regfree(SYN_ITEMS(block)[i].sp_prog);
/* Only free sp_cont_list and sp_next_list of first start pattern */
if (i == 0 || SYN_ITEMS(block)[i - 1].sp_type != SPTYPE_START) {
- vim_free(SYN_ITEMS(block)[i].sp_cont_list);
- vim_free(SYN_ITEMS(block)[i].sp_next_list);
- vim_free(SYN_ITEMS(block)[i].sp_syn.cont_in_list);
+ free(SYN_ITEMS(block)[i].sp_cont_list);
+ free(SYN_ITEMS(block)[i].sp_next_list);
+ free(SYN_ITEMS(block)[i].sp_syn.cont_in_list);
}
}
@@ -3247,9 +3247,9 @@ static void syn_clear_pattern(synblock_T *block, int i)
*/
static void syn_clear_cluster(synblock_T *block, int i)
{
- vim_free(SYN_CLSTR(block)[i].scl_name);
- vim_free(SYN_CLSTR(block)[i].scl_name_u);
- vim_free(SYN_CLSTR(block)[i].scl_list);
+ free(SYN_CLSTR(block)[i].scl_name);
+ free(SYN_CLSTR(block)[i].scl_name_u);
+ free(SYN_CLSTR(block)[i].scl_list);
}
/*
@@ -3305,7 +3305,7 @@ static void syn_cmd_clear(exarg_T *eap, int syncing)
*/
short scl_id = id - SYNID_CLUSTER;
- vim_free(SYN_CLSTR(curwin->w_s)[scl_id].scl_list);
+ free(SYN_CLSTR(curwin->w_s)[scl_id].scl_list);
SYN_CLSTR(curwin->w_s)[scl_id].scl_list = NULL;
}
} else {
@@ -3870,9 +3870,9 @@ static void syn_clear_keyword(int id, hashtab_T *ht)
hi->hi_key = KE2HIKEY(kp_next);
} else
kp_prev->ke_next = kp_next;
- vim_free(kp->next_list);
- vim_free(kp->k_syn.cont_in_list);
- vim_free(kp);
+ free(kp->next_list);
+ free(kp->k_syn.cont_in_list);
+ free(kp);
kp = kp_next;
} else {
kp_prev = kp;
@@ -3900,9 +3900,9 @@ static void clear_keywtab(hashtab_T *ht)
--todo;
for (kp = HI2KE(hi); kp != NULL; kp = kp_next) {
kp_next = kp->ke_next;
- vim_free(kp->next_list);
- vim_free(kp->k_syn.cont_in_list);
- vim_free(kp);
+ free(kp->next_list);
+ free(kp->k_syn.cont_in_list);
+ free(kp);
}
}
}
@@ -4126,12 +4126,12 @@ get_syn_options (
}
if (i < 0) {
EMSG2(_("E394: Didn't find region item for %s"), gname);
- vim_free(gname);
+ free(gname);
return NULL;
}
}
- vim_free(gname);
+ free(gname);
arg = skipwhite(arg);
} else if (flagtab[fidx].flags == HL_FOLD
&& foldmethodIsSyntax(curwin))
@@ -4323,9 +4323,9 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing)
}
}
- vim_free(keyword_copy);
- vim_free(syn_opt_arg.cont_in_list);
- vim_free(syn_opt_arg.next_list);
+ free(keyword_copy);
+ free(syn_opt_arg.cont_in_list);
+ free(syn_opt_arg.next_list);
}
if (rest != NULL)
@@ -4429,10 +4429,10 @@ syn_cmd_match (
* Something failed, free the allocated memory.
*/
vim_regfree(item.sp_prog);
- vim_free(item.sp_pattern);
- vim_free(syn_opt_arg.cont_list);
- vim_free(syn_opt_arg.cont_in_list);
- vim_free(syn_opt_arg.next_list);
+ free(item.sp_pattern);
+ free(syn_opt_arg.cont_list);
+ free(syn_opt_arg.cont_in_list);
+ free(syn_opt_arg.next_list);
if (rest == NULL)
EMSG2(_(e_invarg2), arg);
@@ -4507,7 +4507,7 @@ syn_cmd_region (
key_end = rest;
while (*key_end && !vim_iswhite(*key_end) && *key_end != '=')
++key_end;
- vim_free(key);
+ free(key);
key = vim_strnsave_up(rest, (int)(key_end - rest));
if (key == NULL) { /* out of memory */
rest = NULL;
@@ -4579,7 +4579,7 @@ syn_cmd_region (
++pat_count;
}
}
- vim_free(key);
+ free(key);
if (illegal || not_enough)
rest = NULL;
@@ -4653,17 +4653,17 @@ syn_cmd_region (
for (ppp = pat_ptrs[item]; ppp != NULL; ppp = ppp_next) {
if (!success) {
vim_regfree(ppp->pp_synp->sp_prog);
- vim_free(ppp->pp_synp->sp_pattern);
+ free(ppp->pp_synp->sp_pattern);
}
- vim_free(ppp->pp_synp);
+ free(ppp->pp_synp);
ppp_next = ppp->pp_next;
- vim_free(ppp);
+ free(ppp);
}
if (!success) {
- vim_free(syn_opt_arg.cont_list);
- vim_free(syn_opt_arg.cont_in_list);
- vim_free(syn_opt_arg.next_list);
+ free(syn_opt_arg.cont_list);
+ free(syn_opt_arg.cont_in_list);
+ free(syn_opt_arg.next_list);
if (not_enough)
EMSG2(_("E399: Not enough arguments: syntax region %s"), arg);
else if (illegal || rest == NULL)
@@ -4703,11 +4703,11 @@ static void syn_combine_list(short **clstr1, short **clstr2, int list_op)
return;
if (*clstr1 == NULL || list_op == CLUSTER_REPLACE) {
if (list_op == CLUSTER_REPLACE)
- vim_free(*clstr1);
+ free(*clstr1);
if (list_op == CLUSTER_REPLACE || list_op == CLUSTER_ADD)
*clstr1 = *clstr2;
else
- vim_free(*clstr2);
+ free(*clstr2);
return;
}
@@ -4791,8 +4791,8 @@ static void syn_combine_list(short **clstr1, short **clstr2, int list_op)
/*
* Finally, put the new list in place.
*/
- vim_free(*clstr1);
- vim_free(*clstr2);
+ free(*clstr1);
+ free(*clstr2);
*clstr1 = clstr;
}
@@ -4813,7 +4813,7 @@ static int syn_scl_name2id(char_u *name)
if (SYN_CLSTR(curwin->w_s)[i].scl_name_u != NULL
&& STRCMP(name_u, SYN_CLSTR(curwin->w_s)[i].scl_name_u) == 0)
break;
- vim_free(name_u);
+ free(name_u);
return i < 0 ? 0 : i + SYNID_CLUSTER;
}
@@ -4828,7 +4828,7 @@ static int syn_scl_namen2id(char_u *linep, int len)
name = vim_strnsave(linep, len);
if (name != NULL) {
id = syn_scl_name2id(name);
- vim_free(name);
+ free(name);
}
return id;
}
@@ -4852,7 +4852,7 @@ static int syn_check_cluster(char_u *pp, int len)
if (id == 0) /* doesn't exist yet */
id = syn_add_cluster(name);
else
- vim_free(name);
+ free(name);
return id;
}
@@ -4876,7 +4876,7 @@ static int syn_add_cluster(char_u *name)
len = curwin->w_s->b_syn_clusters.ga_len;
if (len >= MAX_CLUSTER_ID) {
EMSG((char_u *)_("E848: Too many syntax clusters"));
- vim_free(name);
+ free(name);
return 0;
}
@@ -5083,7 +5083,7 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
while (!ends_excmd(*arg_start)) {
arg_end = skiptowhite(arg_start);
next_arg = skipwhite(arg_end);
- vim_free(key);
+ free(key);
key = vim_strnsave_up(arg_start, (int)(arg_end - arg_start));
if (STRCMP(key, "CCOMMENT") == 0) {
if (!eap->skip)
@@ -5154,7 +5154,7 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
syn_clear_time(&curwin->w_s->b_syn_linecont_time);
if (curwin->w_s->b_syn_linecont_prog == NULL) {
- vim_free(curwin->w_s->b_syn_linecont_pat);
+ free(curwin->w_s->b_syn_linecont_pat);
curwin->w_s->b_syn_linecont_pat = NULL;
finished = TRUE;
break;
@@ -5176,7 +5176,7 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
}
arg_start = next_arg;
}
- vim_free(key);
+ free(key);
if (illegal)
EMSG2(_("E404: Illegal arguments: %s"), arg_start);
else if (!finished) {
@@ -5251,13 +5251,13 @@ get_id_list (
if (TOUPPER_ASC(**arg) != 'C') {
EMSG2(_("E407: %s not allowed here"), name + 1);
failed = TRUE;
- vim_free(name);
+ free(name);
break;
}
if (count != 0) {
EMSG2(_("E408: %s must be first in contains list"), name + 1);
failed = TRUE;
- vim_free(name);
+ free(name);
break;
}
if (name[1] == 'A')
@@ -5284,7 +5284,7 @@ get_id_list (
regmatch.regprog = vim_regcomp(name, RE_MAGIC);
if (regmatch.regprog == NULL) {
failed = TRUE;
- vim_free(name);
+ free(name);
break;
}
@@ -5299,7 +5299,7 @@ get_id_list (
* "contains=a.*b,axb".
* Go back to first round */
if (count >= total_count) {
- vim_free(retval);
+ free(retval);
round = 1;
} else
retval[count] = i + 1;
@@ -5311,7 +5311,7 @@ get_id_list (
vim_regfree(regmatch.regprog);
}
}
- vim_free(name);
+ free(name);
if (id == 0) {
EMSG2(_("E409: Unknown group name: %s"), p);
failed = TRUE;
@@ -5321,7 +5321,7 @@ get_id_list (
if (round == 2) {
/* Got more items than expected, go back to first round */
if (count >= total_count) {
- vim_free(retval);
+ free(retval);
round = 1;
} else
retval[count] = id;
@@ -5344,14 +5344,14 @@ get_id_list (
*arg = p;
if (failed || retval == NULL) {
- vim_free(retval);
+ free(retval);
return FAIL;
}
if (*list == NULL)
*list = retval;
else
- vim_free(retval); /* list already found, don't overwrite it */
+ free(retval); /* list already found, don't overwrite it */
return OK;
}
@@ -5531,7 +5531,7 @@ void ex_syntax(exarg_T *eap)
break;
}
}
- vim_free(subcmd_name);
+ free(subcmd_name);
if (eap->skip)
--emsg_skip;
}
@@ -5572,7 +5572,7 @@ void ex_ownsyntax(exarg_T *eap)
do_unlet((char_u *)"b:current_syntax", TRUE);
else {
set_internal_string_var((char_u *)"b:current_syntax", old_value);
- vim_free(old_value);
+ free(old_value);
}
}
@@ -6186,7 +6186,7 @@ int load_colors(char_u *name)
buf = alloc((unsigned)(STRLEN(name) + 12));
sprintf((char *)buf, "colors/%s.vim", name);
retval = source_runtime(buf, FALSE);
- vim_free(buf);
+ free(buf);
apply_autocmds(EVENT_COLORSCHEME, name, curbuf->b_fname, FALSE, curbuf);
recursive = FALSE;
@@ -6389,7 +6389,7 @@ do_highlight (
*/
while (*linep && !vim_iswhite(*linep) && *linep != '=')
++linep;
- vim_free(key);
+ free(key);
key = vim_strnsave_up(key_start, (int)(linep - key_start));
if (key == NULL) {
error = TRUE;
@@ -6437,7 +6437,7 @@ do_highlight (
error = TRUE;
break;
}
- vim_free(arg);
+ free(arg);
arg = vim_strnsave(arg_start, (int)(linep - arg_start));
if (arg == NULL) {
error = TRUE;
@@ -6676,7 +6676,7 @@ do_highlight (
if (!init)
HL_TABLE()[idx].sg_set |= SG_GUI;
- vim_free(HL_TABLE()[idx].sg_gui_fg_name);
+ free(HL_TABLE()[idx].sg_gui_fg_name);
if (STRCMP(arg, "NONE"))
HL_TABLE()[idx].sg_gui_fg_name = vim_strsave(arg);
else
@@ -6687,7 +6687,7 @@ do_highlight (
if (!init)
HL_TABLE()[idx].sg_set |= SG_GUI;
- vim_free(HL_TABLE()[idx].sg_gui_bg_name);
+ free(HL_TABLE()[idx].sg_gui_bg_name);
if (STRCMP(arg, "NONE") != 0)
HL_TABLE()[idx].sg_gui_bg_name = vim_strsave(arg);
else
@@ -6698,7 +6698,7 @@ do_highlight (
if (!init)
HL_TABLE()[idx].sg_set |= SG_GUI;
- vim_free(HL_TABLE()[idx].sg_gui_sp_name);
+ free(HL_TABLE()[idx].sg_gui_sp_name);
if (STRCMP(arg, "NONE") != 0)
HL_TABLE()[idx].sg_gui_sp_name = vim_strsave(arg);
else
@@ -6730,7 +6730,7 @@ do_highlight (
}
/* lookup the escape sequence for the item */
p = get_term_code(tname);
- vim_free(tname);
+ free(tname);
if (p == NULL) /* ignore non-existing things */
p = (char_u *)"";
@@ -6768,10 +6768,10 @@ do_highlight (
else
p = vim_strsave(buf);
if (key[2] == 'A') {
- vim_free(HL_TABLE()[idx].sg_start);
+ free(HL_TABLE()[idx].sg_start);
HL_TABLE()[idx].sg_start = p;
} else {
- vim_free(HL_TABLE()[idx].sg_stop);
+ free(HL_TABLE()[idx].sg_stop);
HL_TABLE()[idx].sg_stop = p;
}
} else {
@@ -6806,8 +6806,8 @@ do_highlight (
HL_TABLE()[idx].sg_scriptID = current_SID;
redraw_all_later(NOT_VALID);
}
- vim_free(key);
- vim_free(arg);
+ free(key);
+ free(arg);
/* Only call highlight_changed() once, after sourcing a syntax file */
need_highlight_changed = TRUE;
@@ -6820,8 +6820,8 @@ void free_highlight(void)
for (i = 0; i < highlight_ga.ga_len; ++i) {
highlight_clear(i);
- vim_free(HL_TABLE()[i].sg_name);
- vim_free(HL_TABLE()[i].sg_name_u);
+ free(HL_TABLE()[i].sg_name);
+ free(HL_TABLE()[i].sg_name_u);
}
ga_clear(&highlight_ga);
}
@@ -6856,9 +6856,9 @@ static int hl_has_settings(int idx, int check_link)
static void highlight_clear(int idx)
{
HL_TABLE()[idx].sg_term = 0;
- vim_free(HL_TABLE()[idx].sg_start);
+ free(HL_TABLE()[idx].sg_start);
HL_TABLE()[idx].sg_start = NULL;
- vim_free(HL_TABLE()[idx].sg_stop);
+ free(HL_TABLE()[idx].sg_stop);
HL_TABLE()[idx].sg_stop = NULL;
HL_TABLE()[idx].sg_term_attr = 0;
HL_TABLE()[idx].sg_cterm = 0;
@@ -6867,11 +6867,11 @@ static void highlight_clear(int idx)
HL_TABLE()[idx].sg_cterm_bg = 0;
HL_TABLE()[idx].sg_cterm_attr = 0;
HL_TABLE()[idx].sg_gui = 0;
- vim_free(HL_TABLE()[idx].sg_gui_fg_name);
+ free(HL_TABLE()[idx].sg_gui_fg_name);
HL_TABLE()[idx].sg_gui_fg_name = NULL;
- vim_free(HL_TABLE()[idx].sg_gui_bg_name);
+ free(HL_TABLE()[idx].sg_gui_bg_name);
HL_TABLE()[idx].sg_gui_bg_name = NULL;
- vim_free(HL_TABLE()[idx].sg_gui_sp_name);
+ free(HL_TABLE()[idx].sg_gui_sp_name);
HL_TABLE()[idx].sg_gui_sp_name = NULL;
/* Clear the script ID only when there is no link, since that is not
* cleared. */
@@ -6997,8 +6997,8 @@ void clear_hl_tables(void)
for (i = 0; i < term_attr_table.ga_len; ++i) {
taep = &(((attrentry_T *)term_attr_table.ga_data)[i]);
- vim_free(taep->ae_u.term.start);
- vim_free(taep->ae_u.term.stop);
+ free(taep->ae_u.term.start);
+ free(taep->ae_u.term.stop);
}
ga_clear(&term_attr_table);
ga_clear(&cterm_attr_table);
@@ -7415,7 +7415,7 @@ int syn_namen2id(char_u *linep, int len)
name = vim_strnsave(linep, len);
if (name != NULL) {
id = syn_name2id(name);
- vim_free(name);
+ free(name);
}
return id;
}
@@ -7439,7 +7439,7 @@ int syn_check_group(char_u *pp, int len)
if (id == 0) /* doesn't exist yet */
id = syn_add_group(name);
else
- vim_free(name);
+ free(name);
return id;
}
@@ -7456,7 +7456,7 @@ static int syn_add_group(char_u *name)
for (p = name; *p != NUL; ++p) {
if (!vim_isprintc(*p)) {
EMSG(_("E669: Unprintable character in group name"));
- vim_free(name);
+ free(name);
return 0;
} else if (!ASCII_ISALNUM(*p) && *p != '_') {
/* This is an error, but since there previously was no check only
@@ -7477,7 +7477,7 @@ static int syn_add_group(char_u *name)
if (highlight_ga.ga_len >= MAX_HL_ID) {
EMSG(_("E849: Too many highlight and syntax groups"));
- vim_free(name);
+ free(name);
return 0;
}
@@ -7501,8 +7501,8 @@ static int syn_add_group(char_u *name)
static void syn_unadd_group(void)
{
--highlight_ga.ga_len;
- vim_free(HL_TABLE()[highlight_ga.ga_len].sg_name);
- vim_free(HL_TABLE()[highlight_ga.ga_len].sg_name_u);
+ free(HL_TABLE()[highlight_ga.ga_len].sg_name);
+ free(HL_TABLE()[highlight_ga.ga_len].sg_name_u);
}
/*
diff --git a/src/tag.c b/src/tag.c
index 47f7e1b97f..4d287c4440 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -234,7 +234,7 @@ do_tag (
cur_match = ptag_entry.cur_match;
cur_fnum = ptag_entry.cur_fnum;
} else {
- vim_free(ptag_entry.tagname);
+ free(ptag_entry.tagname);
if ((ptag_entry.tagname = vim_strsave(tag)) == NULL)
goto end_do_tag;
}
@@ -244,12 +244,12 @@ do_tag (
* stack entries above it.
*/
while (tagstackidx < tagstacklen)
- vim_free(tagstack[--tagstacklen].tagname);
+ free(tagstack[--tagstacklen].tagname);
/* if the tagstack is full: remove oldest entry */
if (++tagstacklen > TAGSTACKSIZE) {
tagstacklen = TAGSTACKSIZE;
- vim_free(tagstack[0].tagname);
+ free(tagstack[0].tagname);
for (i = 1; i < tagstacklen; ++i)
tagstack[i - 1] = tagstack[i];
--tagstackidx;
@@ -443,7 +443,7 @@ do_tag (
|| (cur_match >= num_matches && max_num_matches != MAXCOL)
|| other_name) {
if (other_name) {
- vim_free(tagmatchname);
+ free(tagmatchname);
tagmatchname = vim_strsave(name);
}
@@ -563,7 +563,7 @@ do_tag (
p = tag_full_fname(&tagp);
if (p != NULL) {
msg_puts_long_attr(p, hl_attr(HLF_D));
- vim_free(p);
+ free(p);
}
if (msg_col > 0)
msg_putchar('\n');
@@ -706,7 +706,7 @@ do_tag (
if (p == NULL)
continue;
vim_strncpy(fname, p, MAXPATHL);
- vim_free(p);
+ free(p);
/*
* Get the line number or the search pattern used to locate
@@ -802,8 +802,8 @@ do_tag (
set_errorlist(curwin, list, ' ', IObuff);
list_free(list, TRUE);
- vim_free(fname);
- vim_free(cmd);
+ free(fname);
+ free(cmd);
cur_match = 0; /* Jump to the first tag */
}
@@ -939,7 +939,7 @@ end_do_tag:
*/
void tag_freematch(void)
{
- vim_free(tagmatchname);
+ free(tagmatchname);
tagmatchname = NULL;
}
@@ -981,7 +981,7 @@ void do_tags(exarg_T *eap)
msg_outtrans(IObuff);
msg_outtrans_attr(name, tagstack[i].fmark.fnum == curbuf->b_fnum
? hl_attr(HLF_D) : 0);
- vim_free(name);
+ free(name);
}
out_flush(); /* show one line at a time */
}
@@ -1431,12 +1431,12 @@ line_read_in:
/* Copy or swap lbuf and conv_line. */
len = (int)STRLEN(conv_line) + 1;
if (len > lbuf_size) {
- vim_free(lbuf);
+ free(lbuf);
lbuf = conv_line;
lbuf_size = len;
} else {
STRCPY(lbuf, conv_line);
- vim_free(conv_line);
+ free(conv_line);
}
}
}
@@ -1919,7 +1919,7 @@ parse_line:
[ga_match[mtt].ga_len++] = mfp;
++match_count;
} else
- vim_free(mfp);
+ free(mfp);
}
}
}
@@ -1978,9 +1978,9 @@ parse_line:
}
findtag_end:
- vim_free(lbuf);
+ free(lbuf);
vim_regfree(orgpat.regmatch.regprog);
- vim_free(tag_fname);
+ free(tag_fname);
/*
* Move the matches from the ga_match[] arrays into one list of
@@ -1999,7 +1999,7 @@ findtag_end:
for (i = 0; i < ga_match[mtt].ga_len; ++i) {
mfp = ((struct match_found **)(ga_match[mtt].ga_data))[i];
if (matches == NULL)
- vim_free(mfp);
+ free(mfp);
else {
/* To avoid allocating memory again we turn the struct
* match_found into a string. For help the priority was not
@@ -2016,7 +2016,7 @@ findtag_end:
*num_matches = match_count;
curbuf->b_help = help_save;
- vim_free(saved_pat);
+ free(saved_pat);
return retval;
}
@@ -2042,7 +2042,7 @@ void free_tag_stuff(void)
tag_freematch();
if (ptag_entry.tagname) {
- vim_free(ptag_entry.tagname);
+ free(ptag_entry.tagname);
ptag_entry.tagname = NULL;
}
}
@@ -2153,7 +2153,7 @@ get_tagfname (
}
STRCPY(buf, fname);
- vim_free(fname);
+ free(fname);
return OK;
}
@@ -2162,7 +2162,7 @@ get_tagfname (
*/
void tagname_free(tagname_T *tnp)
{
- vim_free(tnp->tn_tags);
+ free(tnp->tn_tags);
vim_findfile_cleanup(tnp->tn_search_ctx);
tnp->tn_search_ctx = NULL;
ga_clear_strings(&tag_fnames);
@@ -2435,7 +2435,7 @@ jumpto_tag (
&& !has_autocmd(EVENT_BUFREADCMD, fname, NULL)
) {
retval = NOTAGFILE;
- vim_free(nofile_fname);
+ free(nofile_fname);
nofile_fname = vim_strsave(fname);
if (nofile_fname == NULL)
nofile_fname = empty_option;
@@ -2644,9 +2644,9 @@ erret:
g_do_tagpreview = 0; /* For next time */
if (tagp.fname_end != NULL)
*tagp.fname_end = csave;
- vim_free(pbuf);
- vim_free(tofree_fname);
- vim_free(full_fname);
+ free(pbuf);
+ free(tofree_fname);
+ free(full_fname);
return retval;
}
@@ -2690,7 +2690,7 @@ static char_u *expand_tag_fname(char_u *fname, char_u *tag_fname, int expand)
} else
retval = vim_strsave(fname);
- vim_free(expanded_fname);
+ free(expanded_fname);
return retval;
}
@@ -2715,7 +2715,7 @@ static int test_for_current(char_u *fname, char_u *fname_end, char_u *tag_fname,
fullname = expand_tag_fname(fname, tag_fname, TRUE);
if (fullname != NULL) {
retval = (path_full_compare(fullname, buf_ffname, TRUE) & kEqualFiles);
- vim_free(fullname);
+ free(fullname);
}
*fname_end = c;
}
@@ -2845,7 +2845,7 @@ add_tag_field (
}
buf[len] = NUL;
retval = dict_add_nr_str(dict, field_name, 0L, buf);
- vim_free(buf);
+ free(buf);
return retval;
}
@@ -2888,7 +2888,7 @@ int get_tags(list_T *list, char_u *pat)
|| dict_add_nr_str(dict, "static", is_static, NULL) == FAIL)
ret = FAIL;
- vim_free(full_fname);
+ free(full_fname);
if (tp.command_end != NULL) {
for (p = tp.command_end + 3;
@@ -2928,9 +2928,9 @@ int get_tags(list_T *list, char_u *pat)
}
}
- vim_free(matches[i]);
+ free(matches[i]);
}
- vim_free(matches);
+ free(matches);
}
return ret;
}
diff --git a/src/term.c b/src/term.c
index 2b52562838..61dc6f4631 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2933,8 +2933,8 @@ static int termcode_star(char_u *code, int len);
void clear_termcodes(void)
{
while (tc_len > 0)
- vim_free(termcodes[--tc_len].code);
- vim_free(termcodes);
+ free(termcodes[--tc_len].code);
+ free(termcodes);
termcodes = NULL;
tc_max_len = 0;
@@ -2990,7 +2990,7 @@ void add_termcode(char_u *name, char_u *string, int flags)
(unsigned)(tc_max_len * sizeof(struct termcode)));
for (i = 0; i < tc_len; ++i)
new_tc[i] = termcodes[i];
- vim_free(termcodes);
+ free(termcodes);
termcodes = new_tc;
}
@@ -3019,12 +3019,12 @@ void add_termcode(char_u *name, char_u *string, int flags)
&& s[len - 1]
== termcodes[i].code[termcodes[i].len - 1]) {
/* They are equal but for the ";*": don't add it. */
- vim_free(s);
+ free(s);
return;
}
} else {
/* Replace old code. */
- vim_free(termcodes[i].code);
+ free(termcodes[i].code);
--tc_len;
break;
}
@@ -3107,7 +3107,7 @@ static void del_termcode_idx(int idx)
{
int i;
- vim_free(termcodes[idx].code);
+ free(termcodes[idx].code);
--tc_len;
for (i = idx; i < tc_len; ++i)
termcodes[i] = termcodes[i + 1];
@@ -4314,7 +4314,7 @@ replace_termcodes (
*/
if ((*bufp = vim_strsave(result)) != NULL)
from = *bufp;
- vim_free(result);
+ free(result);
return from;
}
@@ -4432,7 +4432,7 @@ void show_termcodes(void)
ui_breakcheck();
}
}
- vim_free(items);
+ free(items);
}
/*
diff --git a/src/ui.c b/src/ui.c
index 7e656bd1ce..4678416200 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -56,7 +56,7 @@ void ui_write(char_u *s, int len)
mch_write(s, len);
if (output_conv.vc_type != CONV_NONE)
- vim_free(tofree);
+ free(tofree);
}
#endif
}
@@ -298,9 +298,9 @@ void set_input_buf(char_u *p)
if (gap->ga_data != NULL) {
memmove(inbuf, gap->ga_data, gap->ga_len);
inbufcount = gap->ga_len;
- vim_free(gap->ga_data);
+ free(gap->ga_data);
}
- vim_free(gap);
+ free(gap);
}
}
@@ -411,7 +411,7 @@ void fill_input_buf(int exit_on_error)
unconverted = restlen;
memmove(inbuf + inbufcount, rest, unconverted);
if (unconverted == restlen) {
- vim_free(rest);
+ free(rest);
rest = NULL;
} else {
restlen -= unconverted;
diff --git a/src/undo.c b/src/undo.c
index 243d865513..0f547f475b 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -726,11 +726,11 @@ char_u *u_get_undo_file_name(char_u *buf_ffname, int reading)
(!reading || mch_stat((char *)undo_file_name, &st) >= 0)) {
break;
}
- vim_free(undo_file_name);
+ free(undo_file_name);
undo_file_name = NULL;
}
- vim_free(munged_name);
+ free(munged_name);
return undo_file_name;
}
@@ -750,7 +750,7 @@ static void u_free_uhp(u_header_T *uhp)
u_freeentry(uep, uep->ue_size);
uep = nuep;
}
- vim_free(uhp);
+ free(uhp);
}
/*
@@ -773,7 +773,7 @@ static size_t fwrite_crypt(buf_T *buf, char_u *ptr, size_t len, FILE *fp)
crypt_encode(ptr, len, copy);
i = fwrite(copy, len, (size_t)1, fp);
if (copy != small_buf)
- vim_free(copy);
+ free(copy);
return i;
}
@@ -810,7 +810,7 @@ static int serialize_header(FILE *fp, buf_T *buf, char_u *hash)
if (header == NULL)
return FAIL;
len = (int)fwrite(header, (size_t)header_len, (size_t)1, fp);
- vim_free(header);
+ free(header);
if (len != 1) {
crypt_pop_state();
return FAIL;
@@ -912,7 +912,7 @@ static u_header_T *unserialize_uhp(FILE *fp, char_u *file_name)
uhp->uh_seq = get4c(fp);
if (uhp->uh_seq <= 0) {
corruption_error("uh_seq", file_name);
- vim_free(uhp);
+ free(uhp);
return NULL;
}
unserialize_pos(&uhp->uh_cursor, fp);
@@ -1316,7 +1316,7 @@ theend:
if (do_crypt)
crypt_pop_state();
if (file_name != name)
- vim_free(file_name);
+ free(file_name);
}
/*
@@ -1589,13 +1589,13 @@ void u_read_undo(char_u *name, char_u *hash, char_u *orig_name)
curbuf->b_u_save_nr_cur = last_save_nr;
curbuf->b_u_synced = TRUE;
- vim_free(uhp_table);
+ free(uhp_table);
#ifdef U_DEBUG
for (i = 0; i < num_head; ++i)
if (uhp_table_used[i] == 0)
EMSGN("uhp_table entry %" PRId64 " not used, leaking memory", i);
- vim_free(uhp_table_used);
+ free(uhp_table_used);
u_check(TRUE);
#endif
@@ -1604,12 +1604,12 @@ void u_read_undo(char_u *name, char_u *hash, char_u *orig_name)
goto theend;
error:
- vim_free(line_ptr);
+ free(line_ptr);
if (uhp_table != NULL) {
for (i = 0; i < num_read_uhps; i++)
if (uhp_table[i] != NULL)
u_free_uhp(uhp_table[i]);
- vim_free(uhp_table);
+ free(uhp_table);
}
theend:
@@ -1618,7 +1618,7 @@ theend:
if (fp != NULL)
fclose(fp);
if (file_name != name)
- vim_free(file_name);
+ free(file_name);
return;
}
@@ -2147,9 +2147,9 @@ static void u_undoredo(int undo)
ml_replace((linenr_T)1, uep->ue_array[i], TRUE);
else
ml_append(lnum, uep->ue_array[i], (colnr_T)0, FALSE);
- vim_free(uep->ue_array[i]);
+ free(uep->ue_array[i]);
}
- vim_free((char_u *)uep->ue_array);
+ free((char_u *)uep->ue_array);
}
/* adjust marks */
@@ -2712,7 +2712,7 @@ u_freeentries (
#ifdef U_DEBUG
uhp->uh_magic = 0;
#endif
- vim_free((char_u *)uhp);
+ free((char_u *)uhp);
--buf->b_u_numhead;
}
@@ -2722,12 +2722,12 @@ u_freeentries (
static void u_freeentry(u_entry_T *uep, long n)
{
while (n > 0)
- vim_free(uep->ue_array[--n]);
- vim_free((char_u *)uep->ue_array);
+ free(uep->ue_array[--n]);
+ free((char_u *)uep->ue_array);
#ifdef U_DEBUG
uep->ue_magic = 0;
#endif
- vim_free((char_u *)uep);
+ free((char_u *)uep);
}
/*
@@ -2768,7 +2768,7 @@ void u_saveline(linenr_T lnum)
void u_clearline(void)
{
if (curbuf->b_u_line_ptr != NULL) {
- vim_free(curbuf->b_u_line_ptr);
+ free(curbuf->b_u_line_ptr);
curbuf->b_u_line_ptr = NULL;
curbuf->b_u_line_lnum = 0;
}
@@ -2805,7 +2805,7 @@ void u_undoline(void)
}
ml_replace(curbuf->b_u_line_lnum, curbuf->b_u_line_ptr, TRUE);
changed_bytes(curbuf->b_u_line_lnum, 0);
- vim_free(curbuf->b_u_line_ptr);
+ free(curbuf->b_u_line_ptr);
curbuf->b_u_line_ptr = oldp;
t = curbuf->b_u_line_colnr;
@@ -2823,7 +2823,7 @@ void u_blockfree(buf_T *buf)
{
while (buf->b_u_oldhead != NULL)
u_freeheader(buf, buf->b_u_oldhead, NULL);
- vim_free(buf->b_u_line_ptr);
+ free(buf->b_u_line_ptr);
}
/*
diff --git a/src/window.c b/src/window.c
index 305bf6b7c9..27582184d7 100644
--- a/src/window.c
+++ b/src/window.c
@@ -441,7 +441,7 @@ wingotofile:
beginline(BL_SOL | BL_FIX);
}
}
- vim_free(ptr);
+ free(ptr);
}
break;
@@ -2024,7 +2024,7 @@ win_free_mem (
/* Remove the window and its frame from the tree of frames. */
frp = win->w_frame;
wp = winframe_remove(win, dirp, tp);
- vim_free(frp);
+ free(frp);
win_free(win, tp);
/* When deleting the current window of another tab page select a new
@@ -2164,7 +2164,7 @@ winframe_remove (
if (frp2->fr_win != NULL)
frp2->fr_win->w_frame = frp2->fr_parent;
frp = frp2->fr_parent;
- vim_free(frp2);
+ free(frp2);
frp2 = frp->fr_parent;
if (frp2 != NULL && frp2->fr_layout == frp->fr_layout) {
@@ -2184,7 +2184,7 @@ winframe_remove (
break;
}
}
- vim_free(frp);
+ free(frp);
}
}
@@ -2866,7 +2866,7 @@ void free_tabpage(tabpage_T *tp)
- vim_free(tp);
+ free(tp);
}
/*
@@ -2886,7 +2886,7 @@ int win_new_tabpage(int after)
/* Remember the current windows in this Tab page. */
if (leave_tabpage(curbuf, TRUE) == FAIL) {
- vim_free(newtp);
+ free(newtp);
return FAIL;
}
curtab = newtp;
@@ -3476,7 +3476,7 @@ static void win_enter_ext(win_T *wp, int undo_sync, int curwin_invalid, int trig
/* Window doesn't have a local directory and we are not in the global
* directory: Change to the global directory. */
ignored = os_chdir((char *)globaldir);
- vim_free(globaldir);
+ free(globaldir);
globaldir = NULL;
shorten_fnames(TRUE);
}
@@ -3645,9 +3645,9 @@ win_free (
win_free_lsize(wp);
for (i = 0; i < wp->w_tagstacklen; ++i)
- vim_free(wp->w_tagstack[i].tagname);
+ free(wp->w_tagstack[i].tagname);
- vim_free(wp->w_localdir);
+ free(wp->w_localdir);
/* Remove the window from the b_wininfo lists, it may happen that the
* freed memory is re-used for another window. */
@@ -3663,11 +3663,11 @@ win_free (
qf_free_all(wp);
- vim_free(wp->w_p_cc_cols);
+ free(wp->w_p_cc_cols);
if (wp != aucmd_win)
win_remove(wp, tp);
- vim_free(wp);
+ free(wp);
unblock_autocmds();
}
@@ -3774,7 +3774,7 @@ void win_alloc_lines(win_T *wp)
*/
void win_free_lsize(win_T *wp)
{
- vim_free(wp->w_lines);
+ free(wp->w_lines);
wp->w_lines = NULL;
}
@@ -5045,7 +5045,7 @@ static void clear_snapshot_rec(frame_T *fr)
if (fr != NULL) {
clear_snapshot_rec(fr->fr_next);
clear_snapshot_rec(fr->fr_child);
- vim_free(fr);
+ free(fr);
}
}
@@ -5319,8 +5319,8 @@ int match_delete(win_T *wp, int id, int perr)
else
prev->next = cur->next;
vim_regfree(cur->match.regprog);
- vim_free(cur->pattern);
- vim_free(cur);
+ free(cur->pattern);
+ free(cur);
redraw_later(SOME_VALID);
return 0;
}
@@ -5335,8 +5335,8 @@ void clear_matches(win_T *wp)
while (wp->w_match_head != NULL) {
m = wp->w_match_head->next;
vim_regfree(wp->w_match_head->match.regprog);
- vim_free(wp->w_match_head->pattern);
- vim_free(wp->w_match_head);
+ free(wp->w_match_head->pattern);
+ free(wp->w_match_head);
wp->w_match_head = m;
}
redraw_later(SOME_VALID);