1
0
forked from aniani/vim

patch 8.1.1386: unessesary type casts for lalloc()

Problem:    Unessesary type casts for lalloc().
Solution:   Remove type casts.  Change lalloc(size, TRUE) to alloc(size).
This commit is contained in:
Bram Moolenaar 2019-05-24 19:39:03 +02:00
parent 71de720c2c
commit 18a4ba29ae
41 changed files with 127 additions and 138 deletions

View File

@ -1958,7 +1958,7 @@ buflist_new(
} }
if (buf != curbuf || curbuf == NULL) if (buf != curbuf || curbuf == NULL)
{ {
buf = (buf_T *)alloc_clear((unsigned)sizeof(buf_T)); buf = (buf_T *)alloc_clear(sizeof(buf_T));
if (buf == NULL) if (buf == NULL)
{ {
vim_free(ffname); vim_free(ffname);
@ -1985,7 +1985,7 @@ buflist_new(
} }
clear_wininfo(buf); clear_wininfo(buf);
buf->b_wininfo = (wininfo_T *)alloc_clear((unsigned)sizeof(wininfo_T)); buf->b_wininfo = (wininfo_T *)alloc_clear(sizeof(wininfo_T));
if ((ffname != NULL && (buf->b_ffname == NULL || buf->b_sfname == NULL)) if ((ffname != NULL && (buf->b_ffname == NULL || buf->b_sfname == NULL))
|| buf->b_wininfo == NULL) || buf->b_wininfo == NULL)
@ -2771,7 +2771,7 @@ buflist_setfpos(
if (wip == NULL) if (wip == NULL)
{ {
/* allocate a new entry */ /* allocate a new entry */
wip = (wininfo_T *)alloc_clear((unsigned)sizeof(wininfo_T)); wip = (wininfo_T *)alloc_clear(sizeof(wininfo_T));
if (wip == NULL) if (wip == NULL)
return; return;
wip->wi_win = win; wip->wi_win = win;
@ -4911,7 +4911,7 @@ do_arg_all(
setpcmark(); setpcmark();
opened_len = ARGCOUNT; opened_len = ARGCOUNT;
opened = alloc_clear((unsigned)opened_len); opened = alloc_clear(opened_len);
if (opened == NULL) if (opened == NULL)
return; return;

View File

@ -282,7 +282,7 @@ f_listener_add(typval_T *argvars, typval_T *rettv)
return; return;
} }
lnr = (listener_T *)alloc_clear((sizeof(listener_T))); lnr = (listener_T *)alloc_clear(sizeof(listener_T));
if (lnr == NULL) if (lnr == NULL)
{ {
free_callback(callback, partial); free_callback(callback, partial);

View File

@ -294,7 +294,7 @@ static int next_ch_id = 0;
add_channel(void) add_channel(void)
{ {
ch_part_T part; ch_part_T part;
channel_T *channel = (channel_T *)alloc_clear((int)sizeof(channel_T)); channel_T *channel = (channel_T *)alloc_clear(sizeof(channel_T));
if (channel == NULL) if (channel == NULL)
return NULL; return NULL;
@ -1728,7 +1728,7 @@ channel_get_all(channel_T *channel, ch_part_T part, int *outlen)
// Concatenate everything into one buffer. // Concatenate everything into one buffer.
for (node = head->rq_next; node != NULL; node = node->rq_next) for (node = head->rq_next; node != NULL; node = node->rq_next)
len += node->rq_buflen; len += node->rq_buflen;
res = lalloc(len + 1, TRUE); res = alloc(len + 1);
if (res == NULL) if (res == NULL)
return NULL; return NULL;
p = res; p = res;

View File

@ -710,7 +710,7 @@ diff_write_buffer(buf_T *buf, diffin_T *din)
// xdiff requires one big block of memory with all the text. // xdiff requires one big block of memory with all the text.
for (lnum = 1; lnum <= buf->b_ml.ml_line_count; ++lnum) for (lnum = 1; lnum <= buf->b_ml.ml_line_count; ++lnum)
len += (long)STRLEN(ml_get_buf(buf, lnum, FALSE)) + 1; len += (long)STRLEN(ml_get_buf(buf, lnum, FALSE)) + 1;
ptr = lalloc(len, TRUE); ptr = alloc(len);
if (ptr == NULL) if (ptr == NULL)
{ {
// Allocating memory failed. This can happen, because we try to read // Allocating memory failed. This can happen, because we try to read

View File

@ -3859,7 +3859,7 @@ replace_push(
if (replace_stack_len <= replace_stack_nr) if (replace_stack_len <= replace_stack_nr)
{ {
replace_stack_len += 50; replace_stack_len += 50;
p = lalloc(sizeof(char_u) * replace_stack_len, TRUE); p = alloc(sizeof(char_u) * replace_stack_len);
if (p == NULL) /* out of memory */ if (p == NULL) /* out of memory */
{ {
replace_stack_len -= 50; replace_stack_len -= 50;

View File

@ -491,7 +491,7 @@ var_redir_start(char_u *name, int append)
if (redir_varname == NULL) if (redir_varname == NULL)
return FAIL; return FAIL;
redir_lval = (lval_T *)alloc_clear((unsigned)sizeof(lval_T)); redir_lval = (lval_T *)alloc_clear(sizeof(lval_T));
if (redir_lval == NULL) if (redir_lval == NULL)
{ {
var_redir_stop(); var_redir_stop();
@ -7288,7 +7288,7 @@ handle_subscript(
typval_T * typval_T *
alloc_tv(void) alloc_tv(void)
{ {
return (typval_T *)alloc_clear((unsigned)sizeof(typval_T)); return (typval_T *)alloc_clear(sizeof(typval_T));
} }
/* /*

View File

@ -397,7 +397,7 @@ ex_sort(exarg_T *eap)
sortbuf1 = NULL; sortbuf1 = NULL;
sortbuf2 = NULL; sortbuf2 = NULL;
regmatch.regprog = NULL; regmatch.regprog = NULL;
nrs = (sorti_T *)lalloc((long_u)(count * sizeof(sorti_T)), TRUE); nrs = (sorti_T *)alloc(count * sizeof(sorti_T));
if (nrs == NULL) if (nrs == NULL)
goto sortend; goto sortend;
@ -793,8 +793,7 @@ ex_retab(exarg_T *eap)
/* len is actual number of white characters used */ /* len is actual number of white characters used */
len = num_spaces + num_tabs; len = num_spaces + num_tabs;
old_len = (long)STRLEN(ptr); old_len = (long)STRLEN(ptr);
new_line = lalloc(old_len - col + start_col + len + 1, new_line = alloc(old_len - col + start_col + len + 1);
TRUE);
if (new_line == NULL) if (new_line == NULL)
break; break;
if (start_col > 0) if (start_col > 0)
@ -1745,7 +1744,7 @@ make_filter_cmd(
len += (long_u)STRLEN(itmp) + 9; /* " { < " + " } " */ len += (long_u)STRLEN(itmp) + 9; /* " { < " + " } " */
if (otmp != NULL) if (otmp != NULL)
len += (long_u)STRLEN(otmp) + (long_u)STRLEN(p_srr) + 2; /* " " */ len += (long_u)STRLEN(otmp) + (long_u)STRLEN(p_srr) + 2; /* " " */
buf = lalloc(len, TRUE); buf = alloc(len);
if (buf == NULL) if (buf == NULL)
return NULL; return NULL;
@ -2536,7 +2535,7 @@ viminfo_readstring(
if (virp->vir_line[off] == Ctrl_V && vim_isdigit(virp->vir_line[off + 1])) if (virp->vir_line[off] == Ctrl_V && vim_isdigit(virp->vir_line[off + 1]))
{ {
len = atol((char *)virp->vir_line + off + 1); len = atol((char *)virp->vir_line + off + 1);
retval = lalloc(len, TRUE); retval = alloc(len);
if (retval == NULL) if (retval == NULL)
{ {
/* Line too long? File messed up? Skip next line. */ /* Line too long? File messed up? Skip next line. */

View File

@ -4166,7 +4166,7 @@ ExpandOne(
len = 0; len = 0;
for (i = 0; i < xp->xp_numfiles; ++i) for (i = 0; i < xp->xp_numfiles; ++i)
len += (long_u)STRLEN(xp->xp_files[i]) + 1; len += (long_u)STRLEN(xp->xp_files[i]) + 1;
ss = lalloc(len, TRUE); ss = alloc(len);
if (ss != NULL) if (ss != NULL)
{ {
*ss = NUL; *ss = NUL;
@ -5914,8 +5914,8 @@ init_history(void)
{ {
if (newlen) if (newlen)
{ {
temp = (histentry_T *)lalloc( temp = (histentry_T *)alloc(
(long_u)(newlen * sizeof(histentry_T)), TRUE); (long_u)(newlen * sizeof(histentry_T)));
if (temp == NULL) /* out of memory! */ if (temp == NULL) /* out of memory! */
{ {
if (type == 0) /* first one: just keep the old length */ if (type == 0) /* first one: just keep the old length */
@ -6688,7 +6688,7 @@ read_viminfo_history(vir_T *virp, int writing)
{ {
/* Need to re-allocate to append the separator byte. */ /* Need to re-allocate to append the separator byte. */
len = STRLEN(val); len = STRLEN(val);
p = lalloc(len + 2, TRUE); p = alloc(len + 2);
if (p != NULL) if (p != NULL)
{ {
if (type == HIST_SEARCH) if (type == HIST_SEARCH)
@ -6774,7 +6774,7 @@ handle_viminfo_history(
{ {
/* Need to re-allocate to append the separator byte. */ /* Need to re-allocate to append the separator byte. */
len = vp[3].bv_len; len = vp[3].bv_len;
p = lalloc(len + 2, TRUE); p = alloc(len + 2);
} }
else else
len = 0; /* for picky compilers */ len = 0; /* for picky compilers */

View File

@ -89,7 +89,7 @@ struct bw_info
int bw_restlen; /* nr of bytes in bw_rest[] */ int bw_restlen; /* nr of bytes in bw_rest[] */
int bw_first; /* first write call */ int bw_first; /* first write call */
char_u *bw_conv_buf; /* buffer for writing converted chars */ char_u *bw_conv_buf; /* buffer for writing converted chars */
int bw_conv_buflen; /* size of bw_conv_buf */ size_t bw_conv_buflen; /* size of bw_conv_buf */
int bw_conv_error; /* set for conversion error */ int bw_conv_error; /* set for conversion error */
linenr_T bw_conv_error_lnum; /* first line with error or zero */ linenr_T bw_conv_error_lnum; /* first line with error or zero */
linenr_T bw_start_lnum; /* line number at start of buffer */ linenr_T bw_start_lnum; /* line number at start of buffer */
@ -1189,7 +1189,7 @@ retry:
{ {
for ( ; size >= 10; size = (long)((long_u)size >> 1)) for ( ; size >= 10; size = (long)((long_u)size >> 1))
{ {
if ((new_buffer = lalloc((long_u)(size + linerest + 1), if ((new_buffer = lalloc(size + linerest + 1,
FALSE)) != NULL) FALSE)) != NULL)
break; break;
} }
@ -4168,8 +4168,7 @@ buf_write(
write_info.bw_conv_buflen = bufsize * 2; write_info.bw_conv_buflen = bufsize * 2;
else /* FIO_UCS4 */ else /* FIO_UCS4 */
write_info.bw_conv_buflen = bufsize * 4; write_info.bw_conv_buflen = bufsize * 4;
write_info.bw_conv_buf write_info.bw_conv_buf = alloc(write_info.bw_conv_buflen);
= lalloc((long_u)write_info.bw_conv_buflen, TRUE);
if (write_info.bw_conv_buf == NULL) if (write_info.bw_conv_buf == NULL)
end = 0; end = 0;
} }
@ -4180,8 +4179,7 @@ buf_write(
{ {
/* Convert UTF-8 -> UCS-2 and UCS-2 -> DBCS. Worst-case * 4: */ /* Convert UTF-8 -> UCS-2 and UCS-2 -> DBCS. Worst-case * 4: */
write_info.bw_conv_buflen = bufsize * 4; write_info.bw_conv_buflen = bufsize * 4;
write_info.bw_conv_buf write_info.bw_conv_buf = alloc(write_info.bw_conv_buflen);
= lalloc((long_u)write_info.bw_conv_buflen, TRUE);
if (write_info.bw_conv_buf == NULL) if (write_info.bw_conv_buf == NULL)
end = 0; end = 0;
} }
@ -4191,8 +4189,7 @@ buf_write(
if (converted && wb_flags == 0 && (wb_flags = get_mac_fio_flags(fenc)) != 0) if (converted && wb_flags == 0 && (wb_flags = get_mac_fio_flags(fenc)) != 0)
{ {
write_info.bw_conv_buflen = bufsize * 3; write_info.bw_conv_buflen = bufsize * 3;
write_info.bw_conv_buf write_info.bw_conv_buf = alloc(write_info.bw_conv_buflen);
= lalloc((long_u)write_info.bw_conv_buflen, TRUE);
if (write_info.bw_conv_buf == NULL) if (write_info.bw_conv_buf == NULL)
end = 0; end = 0;
} }
@ -4212,8 +4209,7 @@ buf_write(
{ {
/* We're going to use iconv(), allocate a buffer to convert in. */ /* We're going to use iconv(), allocate a buffer to convert in. */
write_info.bw_conv_buflen = bufsize * ICONV_MULT; write_info.bw_conv_buflen = bufsize * ICONV_MULT;
write_info.bw_conv_buf write_info.bw_conv_buf = alloc(write_info.bw_conv_buflen);
= lalloc((long_u)write_info.bw_conv_buflen, TRUE);
if (write_info.bw_conv_buf == NULL) if (write_info.bw_conv_buf == NULL)
end = 0; end = 0;
write_info.bw_first = TRUE; write_info.bw_first = TRUE;

View File

@ -156,7 +156,7 @@ get_buffcont(
for (bp = buffer->bh_first.b_next; bp != NULL; bp = bp->b_next) for (bp = buffer->bh_first.b_next; bp != NULL; bp = bp->b_next)
count += (long_u)STRLEN(bp->b_str); count += (long_u)STRLEN(bp->b_str);
if ((count || dozero) && (p = lalloc(count + 1, TRUE)) != NULL) if ((count || dozero) && (p = alloc(count + 1)) != NULL)
{ {
p2 = p; p2 = p;
for (bp = buffer->bh_first.b_next; bp != NULL; bp = bp->b_next) for (bp = buffer->bh_first.b_next; bp != NULL; bp = bp->b_next)
@ -258,8 +258,7 @@ add_buff(
len = MINIMAL_SIZE; len = MINIMAL_SIZE;
else else
len = slen; len = slen;
p = (buffblock_T *)lalloc((long_u)(sizeof(buffblock_T) + len), p = (buffblock_T *)alloc(sizeof(buffblock_T) + len);
TRUE);
if (p == NULL) if (p == NULL)
return; /* no space, just forget it */ return; /* no space, just forget it */
buf->bh_space = (int)(len - slen); buf->bh_space = (int)(len - slen);

View File

@ -4476,7 +4476,7 @@ clip_mch_request_selection(VimClipboard *cbd)
/* In CARBON we don't need a Handle, a pointer is good */ /* In CARBON we don't need a Handle, a pointer is good */
textOfClip = NewHandle(scrapSize); textOfClip = NewHandle(scrapSize);
/* tempclip = lalloc(scrapSize+1, TRUE); */ /* tempclip = alloc(scrapSize+1); */
HLock(textOfClip); HLock(textOfClip);
error = GetScrapFlavorData(scrap, error = GetScrapFlavorData(scrap,
flavor ? VIMSCRAPFLAVOR : SCRAPTEXTFLAVOR, flavor ? VIMSCRAPFLAVOR : SCRAPTEXTFLAVOR,
@ -4488,7 +4488,7 @@ clip_mch_request_selection(VimClipboard *cbd)
else else
type = MAUTO; type = MAUTO;
tempclip = lalloc(scrapSize + 1, TRUE); tempclip = alloc(scrapSize + 1);
mch_memmove(tempclip, *textOfClip + flavor, scrapSize); mch_memmove(tempclip, *textOfClip + flavor, scrapSize);
tempclip[scrapSize] = 0; tempclip[scrapSize] = 0;

View File

@ -6803,12 +6803,12 @@ gui_mch_dialog(
dfltbutton = -1; dfltbutton = -1;
/* Allocate array to hold the width of each button */ /* Allocate array to hold the width of each button */
buttonWidths = (int *)lalloc(numButtons * sizeof(int), TRUE); buttonWidths = (int *)alloc(numButtons * sizeof(int));
if (buttonWidths == NULL) if (buttonWidths == NULL)
return -1; return -1;
/* Allocate array to hold the X position of each button */ /* Allocate array to hold the X position of each button */
buttonPositions = (int *)lalloc(numButtons * sizeof(int), TRUE); buttonPositions = (int *)alloc(numButtons * sizeof(int));
if (buttonPositions == NULL) if (buttonPositions == NULL)
return -1; return -1;

View File

@ -1167,7 +1167,7 @@ gui_mch_prepare(int *argc, char **argv)
* Move all the entries in argv which are relevant to X into gui_argv. * Move all the entries in argv which are relevant to X into gui_argv.
*/ */
gui_argc = 0; gui_argc = 0;
gui_argv = (char **)lalloc((long_u)(*argc * sizeof(char *)), FALSE); gui_argv = (char **)lalloc(*argc * sizeof(char *), FALSE);
if (gui_argv == NULL) if (gui_argv == NULL)
return; return;
gui_argv[gui_argc++] = argv[0]; gui_argv[gui_argc++] = argv[0];

View File

@ -611,7 +611,7 @@ ins_compl_add(
// Allocate a new match structure. // Allocate a new match structure.
// Copy the values to the new match structure. // Copy the values to the new match structure.
match = (compl_T *)alloc_clear((unsigned)sizeof(compl_T)); match = (compl_T *)alloc_clear(sizeof(compl_T));
if (match == NULL) if (match == NULL)
return FAIL; return FAIL;
match->cp_number = -1; match->cp_number = -1;
@ -1071,8 +1071,7 @@ ins_compl_show_pum(void)
if (compl_match_arraysize == 0) if (compl_match_arraysize == 0)
return; return;
compl_match_array = (pumitem_T *)alloc_clear( compl_match_array = (pumitem_T *)alloc_clear(
(unsigned)(sizeof(pumitem_T) sizeof(pumitem_T) * compl_match_arraysize);
* compl_match_arraysize));
if (compl_match_array != NULL) if (compl_match_array != NULL)
{ {
// If the current match is the original text don't find the first // If the current match is the original text don't find the first

View File

@ -583,7 +583,7 @@ add_menu_path(
} }
/* Not already there, so lets add it */ /* Not already there, so lets add it */
menu = (vimmenu_T *)alloc_clear((unsigned)sizeof(vimmenu_T)); menu = (vimmenu_T *)alloc_clear(sizeof(vimmenu_T));
if (menu == NULL) if (menu == NULL)
goto erret; goto erret;

View File

@ -863,7 +863,7 @@ nb_unquote(char_u *p, char_u **endp)
int done = 0; int done = 0;
/* result is never longer than input */ /* result is never longer than input */
result = (char *)alloc_clear((unsigned)STRLEN(p) + 1); result = (char *)alloc_clear(STRLEN(p) + 1);
if (result == NULL) if (result == NULL)
return NULL; return NULL;
@ -3210,7 +3210,8 @@ addsigntype(
if (globalsignmaplen == 0) /* first allocation */ if (globalsignmaplen == 0) /* first allocation */
{ {
globalsignmaplen = 20; globalsignmaplen = 20;
globalsignmap = (char **)alloc_clear(globalsignmaplen*sizeof(char *)); globalsignmap = (char **)alloc_clear(
globalsignmaplen * sizeof(char *));
} }
else /* grow it */ else /* grow it */
{ {

View File

@ -1160,7 +1160,7 @@ stuff_yank(int regname, char_u *p)
if (y_append && y_current->y_array != NULL) if (y_append && y_current->y_array != NULL)
{ {
pp = &(y_current->y_array[y_current->y_size - 1]); pp = &(y_current->y_array[y_current->y_size - 1]);
lp = lalloc((long_u)(STRLEN(*pp) + STRLEN(p) + 1), TRUE); lp = alloc(STRLEN(*pp) + STRLEN(p) + 1);
if (lp == NULL) if (lp == NULL)
{ {
vim_free(p); vim_free(p);
@ -3057,8 +3057,8 @@ op_yank(oparg_T *oap, int deleting, int mess)
y_current->y_size = yanklines; y_current->y_size = yanklines;
y_current->y_type = yanktype; /* set the yank register type */ y_current->y_type = yanktype; /* set the yank register type */
y_current->y_width = 0; y_current->y_width = 0;
y_current->y_array = (char_u **)lalloc_clear((long_u)(sizeof(char_u *) * y_current->y_array = (char_u **)lalloc_clear(sizeof(char_u *) * yanklines,
yanklines), TRUE); TRUE);
if (y_current->y_array == NULL) if (y_current->y_array == NULL)
{ {
y_current = curr; y_current = curr;
@ -3171,8 +3171,8 @@ op_yank(oparg_T *oap, int deleting, int mess)
if (curr != y_current) /* append the new block to the old block */ if (curr != y_current) /* append the new block to the old block */
{ {
new_ptr = (char_u **)lalloc((long_u)(sizeof(char_u *) * new_ptr = (char_u **)alloc(sizeof(char_u *) *
(curr->y_size + y_current->y_size)), TRUE); (curr->y_size + y_current->y_size));
if (new_ptr == NULL) if (new_ptr == NULL)
goto fail; goto fail;
for (j = 0; j < curr->y_size; ++j) for (j = 0; j < curr->y_size; ++j)
@ -3190,8 +3190,8 @@ op_yank(oparg_T *oap, int deleting, int mess)
* the new block, unless being Vi compatible. */ * the new block, unless being Vi compatible. */
if (curr->y_type == MCHAR && vim_strchr(p_cpo, CPO_REGAPPEND) == NULL) if (curr->y_type == MCHAR && vim_strchr(p_cpo, CPO_REGAPPEND) == NULL)
{ {
pnew = lalloc((long_u)(STRLEN(curr->y_array[curr->y_size - 1]) pnew = alloc(STRLEN(curr->y_array[curr->y_size - 1])
+ STRLEN(y_current->y_array[0]) + 1), TRUE); + STRLEN(y_current->y_array[0]) + 1);
if (pnew == NULL) if (pnew == NULL)
{ {
y_idx = y_current->y_size - 1; y_idx = y_current->y_size - 1;
@ -4453,13 +4453,13 @@ do_join(
/* Allocate an array to store the number of spaces inserted before each /* Allocate an array to store the number of spaces inserted before each
* line. We will use it to pre-compute the length of the new line and the * line. We will use it to pre-compute the length of the new line and the
* proper placement of each original line in the new one. */ * proper placement of each original line in the new one. */
spaces = lalloc_clear((long_u)count, TRUE); spaces = lalloc_clear(count, TRUE);
if (spaces == NULL) if (spaces == NULL)
return FAIL; return FAIL;
#if defined(FEAT_COMMENTS) || defined(PROTO) #if defined(FEAT_COMMENTS) || defined(PROTO)
if (remove_comments) if (remove_comments)
{ {
comments = (int *)lalloc_clear((long_u)count * sizeof(int), TRUE); comments = (int *)lalloc_clear(count * sizeof(int), TRUE);
if (comments == NULL) if (comments == NULL)
{ {
vim_free(spaces); vim_free(spaces);
@ -4571,8 +4571,8 @@ do_join(
// Allocate an array to copy the text properties of joined lines into. // Allocate an array to copy the text properties of joined lines into.
// And another array to store the number of properties in each line. // And another array to store the number of properties in each line.
prop_lines = (textprop_T **)alloc_clear( prop_lines = (textprop_T **)alloc_clear(
(int)(count - 1) * sizeof(textprop_T *)); (count - 1) * sizeof(textprop_T *));
prop_lengths = (int *)alloc_clear((int)(count - 1) * sizeof(int)); prop_lengths = (int *)alloc_clear((count - 1) * sizeof(int));
if (prop_lengths == NULL) if (prop_lengths == NULL)
VIM_CLEAR(prop_lines); VIM_CLEAR(prop_lines);
} }
@ -6600,7 +6600,7 @@ clip_convert_selection(char_u **str, long_u *len, VimClipboard *cbd)
if (y_ptr->y_type == MCHAR && *len >= eolsize) if (y_ptr->y_type == MCHAR && *len >= eolsize)
*len -= eolsize; *len -= eolsize;
p = *str = lalloc(*len + 1, TRUE); /* add one to avoid zero */ p = *str = alloc(*len + 1); // add one to avoid zero
if (p == NULL) if (p == NULL)
return -1; return -1;
lnum = 0; lnum = 0;
@ -6818,7 +6818,7 @@ get_reg_contents(int regname, int flags)
++len; ++len;
} }
retval = lalloc(len + 1, TRUE); retval = alloc(len + 1);
/* /*
* Copy the lines of the yank register into the string. * Copy the lines of the yank register into the string.

View File

@ -1448,7 +1448,7 @@ mch_expandpath(
#ifdef __amigaos4__ #ifdef __amigaos4__
Anchor = AllocDosObject(DOS_ANCHORPATH, AnchorTags); Anchor = AllocDosObject(DOS_ANCHORPATH, AnchorTags);
#else #else
Anchor = (struct AnchorPath *)alloc_clear((unsigned)ANCHOR_SIZE); Anchor = (struct AnchorPath *)alloc_clear(ANCHOR_SIZE);
#endif #endif
if (Anchor == NULL) if (Anchor == NULL)
return 0; return 0;

View File

@ -890,7 +890,7 @@ mch_libcall(
else if (retval_str != NULL else if (retval_str != NULL
&& (len = check_str_len(retval_str)) > 0) && (len = check_str_len(retval_str)) > 0)
{ {
*string_result = lalloc((long_u)len, TRUE); *string_result = alloc(len);
if (*string_result != NULL) if (*string_result != NULL)
mch_memmove(*string_result, retval_str, len); mch_memmove(*string_result, retval_str, len);
} }

View File

@ -120,7 +120,7 @@ clip_mch_set_selection(VimClipboard *cbd)
type = clip_convert_selection(&str, &len, cbd); type = clip_convert_selection(&str, &len, cbd);
if (type >= 0) if (type >= 0)
{ {
text_clip = lalloc(len + 1, TRUE); /* Normal text */ text_clip = alloc(len + 1); // Normal text
if (text_clip && vim_clip) if (text_clip && vim_clip)
{ {

View File

@ -4459,9 +4459,9 @@ mch_call_shell_system(
else else
x = system((char *)cmd); x = system((char *)cmd);
# else # else
newcmd = lalloc(STRLEN(p_sh) newcmd = alloc(STRLEN(p_sh)
+ (extra_shell_arg == NULL ? 0 : STRLEN(extra_shell_arg)) + (extra_shell_arg == NULL ? 0 : STRLEN(extra_shell_arg))
+ STRLEN(p_shcf) + STRLEN(cmd) + 4, TRUE); + STRLEN(p_shcf) + STRLEN(cmd) + 4);
if (newcmd == NULL) if (newcmd == NULL)
x = 0; x = 0;
else else

View File

@ -3394,7 +3394,7 @@ mch_get_acl(char_u *fname)
struct my_acl *p = NULL; struct my_acl *p = NULL;
DWORD err; DWORD err;
p = (struct my_acl *)alloc_clear((unsigned)sizeof(struct my_acl)); p = (struct my_acl *)alloc_clear(sizeof(struct my_acl));
if (p != NULL) if (p != NULL)
{ {
WCHAR *wn; WCHAR *wn;
@ -4533,7 +4533,7 @@ mch_call_shell_terminal(
cmdlen = STRLEN(p_sh) + 1; cmdlen = STRLEN(p_sh) + 1;
else else
cmdlen = STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 10; cmdlen = STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 10;
newcmd = lalloc(cmdlen, TRUE); newcmd = alloc(cmdlen);
if (newcmd == NULL) if (newcmd == NULL)
return 255; return 255;
if (cmd == NULL) if (cmd == NULL)
@ -4772,7 +4772,7 @@ mch_call_shell(
{ {
/* make "cmd.exe /c arguments" */ /* make "cmd.exe /c arguments" */
cmdlen = STRLEN(cmd_shell) + STRLEN(subcmd) + 5; cmdlen = STRLEN(cmd_shell) + STRLEN(subcmd) + 5;
newcmd = lalloc(cmdlen, TRUE); newcmd = alloc(cmdlen);
if (newcmd != NULL) if (newcmd != NULL)
vim_snprintf((char *)newcmd, cmdlen, "%s /c %s", vim_snprintf((char *)newcmd, cmdlen, "%s /c %s",
cmd_shell, subcmd); cmd_shell, subcmd);
@ -4827,7 +4827,7 @@ mch_call_shell(
#endif #endif
STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 10; STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 10;
newcmd = lalloc(cmdlen, TRUE); newcmd = alloc(cmdlen);
if (newcmd != NULL) if (newcmd != NULL)
{ {
#if defined(FEAT_GUI_MSWIN) #if defined(FEAT_GUI_MSWIN)

View File

@ -1071,7 +1071,7 @@ split_message(char_u *mesg, pumitem_T **array)
* position. */ * position. */
if (height > max_height) if (height > max_height)
height = max_height; height = max_height;
*array = (pumitem_T *)alloc_clear((unsigned)sizeof(pumitem_T) * height); *array = (pumitem_T *)alloc_clear(sizeof(pumitem_T) * height);
if (*array == NULL) if (*array == NULL)
goto failed; goto failed;
@ -1165,7 +1165,7 @@ ui_post_balloon(char_u *mesg, list_T *list)
balloon_arraysize = list->lv_len; balloon_arraysize = list->lv_len;
balloon_array = (pumitem_T *)alloc_clear( balloon_array = (pumitem_T *)alloc_clear(
(unsigned)sizeof(pumitem_T) * list->lv_len); sizeof(pumitem_T) * list->lv_len);
if (balloon_array == NULL) if (balloon_array == NULL)
return; return;
for (idx = 0, li = list->lv_first; li != NULL; li = li->li_next, ++idx) for (idx = 0, li = list->lv_first; li != NULL; li = li->li_next, ++idx)
@ -1271,7 +1271,7 @@ pum_show_popupmenu(vimmenu_T *menu)
return; return;
} }
array = (pumitem_T *)alloc_clear((unsigned)sizeof(pumitem_T) * pum_size); array = (pumitem_T *)alloc_clear(sizeof(pumitem_T) * pum_size);
if (array == NULL) if (array == NULL)
return; return;

View File

@ -540,7 +540,7 @@ parse_efm_option(char_u *efm)
while (efm[0] != NUL) while (efm[0] != NUL)
{ {
// Allocate a new eformat structure and put it at the end of the list // Allocate a new eformat structure and put it at the end of the list
fmt_ptr = (efm_T *)alloc_clear((unsigned)sizeof(efm_T)); fmt_ptr = (efm_T *)alloc_clear(sizeof(efm_T));
if (fmt_ptr == NULL) if (fmt_ptr == NULL)
goto parse_efm_error; goto parse_efm_error;
if (fmt_first == NULL) // first one if (fmt_first == NULL) // first one
@ -2141,7 +2141,7 @@ qf_alloc_stack(qfltype_T qfltype)
{ {
qf_info_T *qi; qf_info_T *qi;
qi = (qf_info_T *)alloc_clear((unsigned)sizeof(qf_info_T)); qi = (qf_info_T *)alloc_clear(sizeof(qf_info_T));
if (qi != NULL) if (qi != NULL)
{ {
qi->qf_refcount++; qi->qf_refcount++;

View File

@ -1319,7 +1319,7 @@ bt_regcomp(char_u *expr, int re_flags)
return NULL; return NULL;
/* Allocate space. */ /* Allocate space. */
r = (bt_regprog_T *)lalloc(sizeof(bt_regprog_T) + regsize, TRUE); r = (bt_regprog_T *)alloc(sizeof(bt_regprog_T) + regsize);
if (r == NULL) if (r == NULL)
return NULL; return NULL;
r->re_in_use = FALSE; r->re_in_use = FALSE;
@ -3932,7 +3932,7 @@ make_extmatch(void)
{ {
reg_extmatch_T *em; reg_extmatch_T *em;
em = (reg_extmatch_T *)alloc_clear((unsigned)sizeof(reg_extmatch_T)); em = (reg_extmatch_T *)alloc_clear(sizeof(reg_extmatch_T));
if (em != NULL) if (em != NULL)
em->refcnt = 1; em->refcnt = 1;
return em; return em;
@ -7830,7 +7830,7 @@ reg_submatch(int no)
if (retval == NULL) if (retval == NULL)
{ {
retval = lalloc((long_u)len, TRUE); retval = alloc(len);
if (retval == NULL) if (retval == NULL)
return NULL; return NULL;
} }

View File

@ -300,7 +300,7 @@ nfa_regcomp_start(
/* Size for postfix representation of expr. */ /* Size for postfix representation of expr. */
postfix_size = sizeof(int) * nstate_max; postfix_size = sizeof(int) * nstate_max;
post_start = (int *)lalloc(postfix_size, TRUE); post_start = (int *)alloc(postfix_size);
if (post_start == NULL) if (post_start == NULL)
return FAIL; return FAIL;
post_ptr = post_start; post_ptr = post_start;
@ -516,7 +516,7 @@ realloc_post_list(void)
// For weird patterns the number of states can be very high. Increasing by // For weird patterns the number of states can be very high. Increasing by
// 50% seems a reasonable compromise between memory use and speed. // 50% seems a reasonable compromise between memory use and speed.
new_max = nstate_max * 3 / 2; new_max = nstate_max * 3 / 2;
new_start = (int *)lalloc(new_max * sizeof(int), TRUE); new_start = (int *)alloc(new_max * sizeof(int));
if (new_start == NULL) if (new_start == NULL)
return FAIL; return FAIL;
mch_memmove(new_start, post_start, nstate_max * sizeof(int)); mch_memmove(new_start, post_start, nstate_max * sizeof(int));
@ -3214,7 +3214,7 @@ post2nfa(int *postfix, int *end, int nfa_calc_size)
if (nfa_calc_size == FALSE) if (nfa_calc_size == FALSE)
{ {
// Allocate space for the stack. Max states on the stack: "nstate'. // Allocate space for the stack. Max states on the stack: "nstate'.
stack = (Frag_T *)lalloc((nstate + 1) * sizeof(Frag_T), TRUE); stack = (Frag_T *)alloc((nstate + 1) * sizeof(Frag_T));
if (stack == NULL) if (stack == NULL)
return NULL; return NULL;
stackp = stack; stackp = stack;
@ -5184,7 +5184,7 @@ recursive_regmatch(
if (*listids == NULL || *listids_len < prog->nstate) if (*listids == NULL || *listids_len < prog->nstate)
{ {
vim_free(*listids); vim_free(*listids);
*listids = (int *)lalloc(sizeof(int) * prog->nstate, TRUE); *listids = (int *)alloc(sizeof(int) * prog->nstate);
if (*listids == NULL) if (*listids == NULL)
{ {
emsg(_("E878: (NFA) Could not allocate memory for branch traversal!")); emsg(_("E878: (NFA) Could not allocate memory for branch traversal!"));
@ -5567,9 +5567,9 @@ nfa_regmatch(
/* Allocate memory for the lists of nodes. */ /* Allocate memory for the lists of nodes. */
size = (prog->nstate + 1) * sizeof(nfa_thread_T); size = (prog->nstate + 1) * sizeof(nfa_thread_T);
list[0].t = (nfa_thread_T *)lalloc(size, TRUE); list[0].t = (nfa_thread_T *)alloc(size);
list[0].len = prog->nstate + 1; list[0].len = prog->nstate + 1;
list[1].t = (nfa_thread_T *)lalloc(size, TRUE); list[1].t = (nfa_thread_T *)alloc(size);
list[1].len = prog->nstate + 1; list[1].len = prog->nstate + 1;
if (list[0].t == NULL || list[1].t == NULL) if (list[0].t == NULL || list[1].t == NULL)
goto theend; goto theend;
@ -7276,7 +7276,7 @@ nfa_regcomp(char_u *expr, int re_flags)
/* allocate the regprog with space for the compiled regexp */ /* allocate the regprog with space for the compiled regexp */
prog_size = sizeof(nfa_regprog_T) + sizeof(nfa_state_T) * (nstate - 1); prog_size = sizeof(nfa_regprog_T) + sizeof(nfa_state_T) * (nstate - 1);
prog = (nfa_regprog_T *)lalloc(prog_size, TRUE); prog = (nfa_regprog_T *)alloc(prog_size);
if (prog == NULL) if (prog == NULL)
goto fail; goto fail;
state_ptr = prog->state; state_ptr = prog->state;

View File

@ -8782,26 +8782,25 @@ retry:
if (aucmd_win != NULL) if (aucmd_win != NULL)
win_free_lsize(aucmd_win); win_free_lsize(aucmd_win);
new_ScreenLines = (schar_T *)lalloc((long_u)( new_ScreenLines = (schar_T *)lalloc(
(Rows + 1) * Columns * sizeof(schar_T)), FALSE); (Rows + 1) * Columns * sizeof(schar_T), FALSE);
vim_memset(new_ScreenLinesC, 0, sizeof(u8char_T *) * MAX_MCO); vim_memset(new_ScreenLinesC, 0, sizeof(u8char_T *) * MAX_MCO);
if (enc_utf8) if (enc_utf8)
{ {
new_ScreenLinesUC = (u8char_T *)lalloc((long_u)( new_ScreenLinesUC = (u8char_T *)lalloc(
(Rows + 1) * Columns * sizeof(u8char_T)), FALSE); (Rows + 1) * Columns * sizeof(u8char_T), FALSE);
for (i = 0; i < p_mco; ++i) for (i = 0; i < p_mco; ++i)
new_ScreenLinesC[i] = (u8char_T *)lalloc_clear((long_u)( new_ScreenLinesC[i] = (u8char_T *)lalloc_clear(
(Rows + 1) * Columns * sizeof(u8char_T)), FALSE); (Rows + 1) * Columns * sizeof(u8char_T), FALSE);
} }
if (enc_dbcs == DBCS_JPNU) if (enc_dbcs == DBCS_JPNU)
new_ScreenLines2 = (schar_T *)lalloc((long_u)( new_ScreenLines2 = (schar_T *)lalloc(
(Rows + 1) * Columns * sizeof(schar_T)), FALSE); (Rows + 1) * Columns * sizeof(schar_T), FALSE);
new_ScreenAttrs = (sattr_T *)lalloc((long_u)( new_ScreenAttrs = (sattr_T *)lalloc(
(Rows + 1) * Columns * sizeof(sattr_T)), FALSE); (Rows + 1) * Columns * sizeof(sattr_T), FALSE);
new_LineOffset = (unsigned *)lalloc((long_u)( new_LineOffset = (unsigned *)lalloc(Rows * sizeof(unsigned), FALSE);
Rows * sizeof(unsigned)), FALSE); new_LineWraps = (char_u *)lalloc(Rows * sizeof(char_u), FALSE);
new_LineWraps = (char_u *)lalloc((long_u)(Rows * sizeof(char_u)), FALSE); new_TabPageIdxs = (short *)lalloc(Columns * sizeof(short), FALSE);
new_TabPageIdxs = (short *)lalloc((long_u)(Columns * sizeof(short)), FALSE);
FOR_ALL_TAB_WINDOWS(tp, wp) FOR_ALL_TAB_WINDOWS(tp, wp)
{ {
@ -10741,7 +10740,7 @@ redraw_win_toolbar(win_T *wp)
for (menu = wp->w_winbar->children; menu != NULL; menu = menu->next) for (menu = wp->w_winbar->children; menu != NULL; menu = menu->next)
++item_count; ++item_count;
wp->w_winbar_items = (winbar_item_T *)alloc_clear( wp->w_winbar_items = (winbar_item_T *)alloc_clear(
(unsigned)sizeof(winbar_item_T) * (item_count + 1)); sizeof(winbar_item_T) * (item_count + 1));
/* TODO: use fewer spaces if there is not enough room */ /* TODO: use fewer spaces if there is not enough room */
for (menu = wp->w_winbar->children; for (menu = wp->w_winbar->children;

View File

@ -5137,8 +5137,8 @@ find_pattern_in_path(
goto fpip_end; goto fpip_end;
def_regmatch.rm_ic = FALSE; /* don't ignore case in define pat. */ def_regmatch.rm_ic = FALSE; /* don't ignore case in define pat. */
} }
files = (SearchedFile *)lalloc_clear((long_u) files = (SearchedFile *)lalloc_clear(
(max_path_depth * sizeof(SearchedFile)), TRUE); max_path_depth * sizeof(SearchedFile), TRUE);
if (files == NULL) if (files == NULL)
goto fpip_end; goto fpip_end;
old_files = max_path_depth; old_files = max_path_depth;
@ -5298,8 +5298,8 @@ find_pattern_in_path(
/* Push the new file onto the file stack */ /* Push the new file onto the file stack */
if (depth + 1 == old_files) if (depth + 1 == old_files)
{ {
bigger = (SearchedFile *)lalloc((long_u)( bigger = (SearchedFile *)alloc(
max_path_depth * 2 * sizeof(SearchedFile)), TRUE); max_path_depth * 2 * sizeof(SearchedFile));
if (bigger != NULL) if (bigger != NULL)
{ {
for (i = 0; i <= depth; i++) for (i = 0; i <= depth; i++)

View File

@ -202,7 +202,7 @@ insert_sign(
{ {
signlist_T *newsign; signlist_T *newsign;
newsign = (signlist_T *)lalloc_id((long_u)sizeof(signlist_T), FALSE, newsign = (signlist_T *)lalloc_id(sizeof(signlist_T), FALSE,
aid_insert_sign); aid_insert_sign);
if (newsign != NULL) if (newsign != NULL)
{ {
@ -1057,7 +1057,7 @@ sign_jump(int sign_id, char_u *sign_group, buf_T *buf)
emsg(_("E934: Cannot jump to a buffer that does not have a name")); emsg(_("E934: Cannot jump to a buffer that does not have a name"));
return -1; return -1;
} }
cmd = alloc((unsigned)STRLEN(buf->b_fname) + 25); cmd = alloc(STRLEN(buf->b_fname) + 25);
if (cmd == NULL) if (cmd == NULL)
return -1; return -1;
sprintf((char *)cmd, "e +%ld %s", (long)lnum, buf->b_fname); sprintf((char *)cmd, "e +%ld %s", (long)lnum, buf->b_fname);

View File

@ -7820,8 +7820,7 @@ spell_edit_score(
/* We use "cnt" as an array: CNT(badword_idx, goodword_idx). */ /* We use "cnt" as an array: CNT(badword_idx, goodword_idx). */
#define CNT(a, b) cnt[(a) + (b) * (badlen + 1)] #define CNT(a, b) cnt[(a) + (b) * (badlen + 1)]
cnt = (int *)lalloc((long_u)(sizeof(int) * (badlen + 1) * (goodlen + 1)), cnt = (int *)alloc(sizeof(int) * (badlen + 1) * (goodlen + 1));
TRUE);
if (cnt == NULL) if (cnt == NULL)
return 0; /* out of memory */ return 0; /* out of memory */

View File

@ -892,8 +892,7 @@ read_prefcond_section(FILE *fd, slang_T *lp)
if (cnt <= 0) if (cnt <= 0)
return SP_FORMERROR; return SP_FORMERROR;
lp->sl_prefprog = (regprog_T **)alloc_clear( lp->sl_prefprog = (regprog_T **)alloc_clear(sizeof(regprog_T *) * cnt);
(unsigned)sizeof(regprog_T *) * cnt);
if (lp->sl_prefprog == NULL) if (lp->sl_prefprog == NULL)
return SP_OTHERERROR; return SP_OTHERERROR;
lp->sl_prefixcnt = cnt; lp->sl_prefixcnt = cnt;
@ -1580,13 +1579,13 @@ spell_read_tree(
if (len > 0) if (len > 0)
{ {
/* Allocate the byte array. */ /* Allocate the byte array. */
bp = lalloc((long_u)len, TRUE); bp = alloc(len);
if (bp == NULL) if (bp == NULL)
return SP_OTHERERROR; return SP_OTHERERROR;
*bytsp = bp; *bytsp = bp;
/* Allocate the index array. */ /* Allocate the index array. */
ip = (idx_T *)lalloc_clear((long_u)(len * sizeof(int)), TRUE); ip = (idx_T *)lalloc_clear(len * sizeof(int), TRUE);
if (ip == NULL) if (ip == NULL)
return SP_OTHERERROR; return SP_OTHERERROR;
*idxsp = ip; *idxsp = ip;
@ -4272,8 +4271,7 @@ getroom(
bl = NULL; bl = NULL;
else else
/* Allocate a block of memory. It is not freed until much later. */ /* Allocate a block of memory. It is not freed until much later. */
bl = (sblock_T *)alloc_clear( bl = (sblock_T *)alloc_clear(sizeof(sblock_T) + SBLOCKSIZE);
(unsigned)(sizeof(sblock_T) + SBLOCKSIZE));
if (bl == NULL) if (bl == NULL)
{ {
if (!spin->si_did_emsg) if (!spin->si_did_emsg)

View File

@ -1215,7 +1215,7 @@ syn_stack_alloc(void)
len = syn_block->b_sst_len - syn_block->b_sst_freecount + 2; len = syn_block->b_sst_len - syn_block->b_sst_freecount + 2;
} }
sstp = (synstate_T *)alloc_clear((unsigned)(len * sizeof(synstate_T))); sstp = (synstate_T *)alloc_clear(len * sizeof(synstate_T));
if (sstp == NULL) /* out of memory! */ if (sstp == NULL) /* out of memory! */
return; return;
@ -5216,7 +5216,7 @@ syn_cmd_region(
} }
ppp->pp_next = pat_ptrs[item]; ppp->pp_next = pat_ptrs[item];
pat_ptrs[item] = ppp; pat_ptrs[item] = ppp;
ppp->pp_synp = (synpat_T *)alloc_clear((unsigned)sizeof(synpat_T)); ppp->pp_synp = (synpat_T *)alloc_clear(sizeof(synpat_T));
if (ppp->pp_synp == NULL) if (ppp->pp_synp == NULL)
{ {
rest = NULL; rest = NULL;

View File

@ -2789,8 +2789,7 @@ findtag_end:
match_count = 0; match_count = 0;
if (match_count > 0) if (match_count > 0)
matches = (char_u **)lalloc((long_u)(match_count * sizeof(char_u *)), matches = (char_u **)alloc(match_count * sizeof(char_u *));
TRUE);
else else
matches = NULL; matches = NULL;
match_count = 0; match_count = 0;

View File

@ -3925,7 +3925,7 @@ static VTermParserCallbacks parser_fallbacks = {
static void * static void *
vterm_malloc(size_t size, void *data UNUSED) vterm_malloc(size_t size, void *data UNUSED)
{ {
return alloc_clear((unsigned) size); return alloc_clear(size);
} }
static void static void

View File

@ -678,7 +678,7 @@ prop_type_set(typval_T *argvars, int add)
semsg(_("E969: Property type %s already defined"), name); semsg(_("E969: Property type %s already defined"), name);
return; return;
} }
prop = (proptype_T *)alloc_clear((int)(sizeof(proptype_T) + STRLEN(name))); prop = (proptype_T *)alloc_clear(sizeof(proptype_T) + STRLEN(name));
if (prop == NULL) if (prop == NULL)
return; return;
STRCPY(prop->pt_name, name); STRCPY(prop->pt_name, name);

View File

@ -1514,7 +1514,7 @@ clip_copy_modeless_selection(int both UNUSED)
len *= 2; /* max. 2 bytes per display cell */ len *= 2; /* max. 2 bytes per display cell */
else if (enc_utf8) else if (enc_utf8)
len *= MB_MAXBYTES; len *= MB_MAXBYTES;
buffer = lalloc((long_u)len, TRUE); buffer = alloc(len);
if (buffer == NULL) /* out of memory */ if (buffer == NULL) /* out of memory */
return; return;
@ -1897,11 +1897,11 @@ get_input_buf(void)
garray_T *gap; garray_T *gap;
/* We use a growarray to store the data pointer and the length. */ /* We use a growarray to store the data pointer and the length. */
gap = (garray_T *)alloc((unsigned)sizeof(garray_T)); gap = (garray_T *)alloc(sizeof(garray_T));
if (gap != NULL) if (gap != NULL)
{ {
/* Add one to avoid a zero size. */ /* Add one to avoid a zero size. */
gap->ga_data = alloc((unsigned)inbufcount + 1); gap->ga_data = alloc(inbufcount + 1);
if (gap->ga_data != NULL) if (gap->ga_data != NULL)
mch_memmove(gap->ga_data, inbuf, (size_t)inbufcount); mch_memmove(gap->ga_data, inbuf, (size_t)inbufcount);
gap->ga_len = inbufcount; gap->ga_len = inbufcount;

View File

@ -124,7 +124,7 @@ static void serialize_visualinfo(bufinfo_T *bi, visualinfo_T *info);
static void unserialize_visualinfo(bufinfo_T *bi, visualinfo_T *info); static void unserialize_visualinfo(bufinfo_T *bi, visualinfo_T *info);
#endif #endif
#define U_ALLOC_LINE(size) lalloc((long_u)(size), FALSE) #define U_ALLOC_LINE(size) lalloc(size, FALSE)
/* used in undo_end() to report number of added and deleted lines */ /* used in undo_end() to report number of added and deleted lines */
static long u_newcount, u_oldcount; static long u_newcount, u_oldcount;
@ -2013,8 +2013,7 @@ u_read_undo(char_u *name, char_u *hash, char_u *orig_name)
} }
#ifdef U_DEBUG #ifdef U_DEBUG
uhp_table_used = (int *)alloc_clear( uhp_table_used = (int *)alloc_clear(sizeof(int) * num_head + 1);
(unsigned)(sizeof(int) * num_head + 1));
# define SET_FLAG(j) ++uhp_table_used[j] # define SET_FLAG(j) ++uhp_table_used[j]
#else #else
# define SET_FLAG(j) # define SET_FLAG(j)

View File

@ -292,10 +292,10 @@ get_lambda_tv(char_u **arg, typval_T *rettv, int evaluate)
sprintf((char*)name, "<lambda>%d", ++lambda_no); sprintf((char*)name, "<lambda>%d", ++lambda_no);
fp = (ufunc_T *)alloc_clear((unsigned)(sizeof(ufunc_T) + STRLEN(name))); fp = (ufunc_T *)alloc_clear(sizeof(ufunc_T) + STRLEN(name));
if (fp == NULL) if (fp == NULL)
goto errret; goto errret;
pt = (partial_T *)alloc_clear((unsigned)sizeof(partial_T)); pt = (partial_T *)alloc_clear(sizeof(partial_T));
if (pt == NULL) if (pt == NULL)
goto errret; goto errret;
@ -2580,7 +2580,7 @@ ex_function(exarg_T *eap)
} }
} }
fp = (ufunc_T *)alloc_clear((unsigned)(sizeof(ufunc_T) + STRLEN(name))); fp = (ufunc_T *)alloc_clear(sizeof(ufunc_T) + STRLEN(name));
if (fp == NULL) if (fp == NULL)
goto erret; goto erret;
@ -2751,14 +2751,13 @@ func_do_profile(ufunc_T *fp)
profile_zero(&fp->uf_tm_self); profile_zero(&fp->uf_tm_self);
profile_zero(&fp->uf_tm_total); profile_zero(&fp->uf_tm_total);
if (fp->uf_tml_count == NULL) if (fp->uf_tml_count == NULL)
fp->uf_tml_count = (int *)alloc_clear( fp->uf_tml_count = (int *)alloc_clear(sizeof(int) * len);
(unsigned)(sizeof(int) * len));
if (fp->uf_tml_total == NULL) if (fp->uf_tml_total == NULL)
fp->uf_tml_total = (proftime_T *)alloc_clear( fp->uf_tml_total = (proftime_T *)alloc_clear(
(unsigned)(sizeof(proftime_T) * len)); sizeof(proftime_T) * len);
if (fp->uf_tml_self == NULL) if (fp->uf_tml_self == NULL)
fp->uf_tml_self = (proftime_T *)alloc_clear( fp->uf_tml_self = (proftime_T *)alloc_clear(
(unsigned)(sizeof(proftime_T) * len)); sizeof(proftime_T) * len);
fp->uf_tml_idx = -1; fp->uf_tml_idx = -1;
if (fp->uf_tml_count == NULL || fp->uf_tml_total == NULL if (fp->uf_tml_count == NULL || fp->uf_tml_total == NULL
|| fp->uf_tml_self == NULL) || fp->uf_tml_self == NULL)

View File

@ -767,6 +767,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1386,
/**/ /**/
1385, 1385,
/**/ /**/

View File

@ -244,7 +244,7 @@ crnl_to_nl(const char_u *str, int *size)
char_u *retp; char_u *retp;
/* Avoid allocating zero bytes, it generates an error message. */ /* Avoid allocating zero bytes, it generates an error message. */
ret = lalloc((long_u)(str_len == 0 ? 1 : str_len), TRUE); ret = alloc(str_len == 0 ? 1 : str_len);
if (ret != NULL) if (ret != NULL)
{ {
retp = ret; retp = ret;

View File

@ -1065,7 +1065,7 @@ win_split_ins(
if (curfrp->fr_parent == NULL || curfrp->fr_parent->fr_layout != layout) if (curfrp->fr_parent == NULL || curfrp->fr_parent->fr_layout != layout)
{ {
/* Need to create a new frame in the tree to make a branch. */ /* Need to create a new frame in the tree to make a branch. */
frp = (frame_T *)alloc_clear((unsigned)sizeof(frame_T)); frp = (frame_T *)alloc_clear(sizeof(frame_T));
*frp = *curfrp; *frp = *curfrp;
curfrp->fr_layout = layout; curfrp->fr_layout = layout;
frp->fr_parent = curfrp; frp->fr_parent = curfrp;
@ -3549,7 +3549,7 @@ win_alloc_firstwin(win_T *oldwin)
static void static void
new_frame(win_T *wp) new_frame(win_T *wp)
{ {
frame_T *frp = (frame_T *)alloc_clear((unsigned)sizeof(frame_T)); frame_T *frp = (frame_T *)alloc_clear(sizeof(frame_T));
wp->w_frame = frp; wp->w_frame = frp;
if (frp != NULL) if (frp != NULL)
@ -3584,7 +3584,7 @@ alloc_tabpage(void)
# endif # endif
tp = (tabpage_T *)alloc_clear((unsigned)sizeof(tabpage_T)); tp = (tabpage_T *)alloc_clear(sizeof(tabpage_T));
if (tp == NULL) if (tp == NULL)
return NULL; return NULL;
@ -4597,7 +4597,7 @@ win_alloc(win_T *after UNUSED, int hidden UNUSED)
/* /*
* allocate window structure and linesizes arrays * allocate window structure and linesizes arrays
*/ */
new_wp = (win_T *)alloc_clear((unsigned)sizeof(win_T)); new_wp = (win_T *)alloc_clear(sizeof(win_T));
if (new_wp == NULL) if (new_wp == NULL)
return NULL; return NULL;
@ -4898,7 +4898,7 @@ frame_remove(frame_T *frp)
win_alloc_lines(win_T *wp) win_alloc_lines(win_T *wp)
{ {
wp->w_lines_valid = 0; wp->w_lines_valid = 0;
wp->w_lines = (wline_T *)alloc_clear((unsigned)(Rows * sizeof(wline_T))); wp->w_lines = (wline_T *)alloc_clear(Rows * sizeof(wline_T));
if (wp->w_lines == NULL) if (wp->w_lines == NULL)
return FAIL; return FAIL;
return OK; return OK;
@ -6280,7 +6280,7 @@ make_snapshot(int idx)
static void static void
make_snapshot_rec(frame_T *fr, frame_T **frp) make_snapshot_rec(frame_T *fr, frame_T **frp)
{ {
*frp = (frame_T *)alloc_clear((unsigned)sizeof(frame_T)); *frp = (frame_T *)alloc_clear(sizeof(frame_T));
if (*frp == NULL) if (*frp == NULL)
return; return;
(*frp)->fr_layout = fr->fr_layout; (*frp)->fr_layout = fr->fr_layout;