mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 05:58:33 +00:00
replaced vim_free()
calls with free()
calls
This commit is contained in:

committed by
Justin M. Keyes

parent
c5cac800e7
commit
f9d4c78ddc
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user