summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-05-24 18:54:09 +0200
committerBram Moolenaar <Bram@vim.org>2019-05-24 18:54:09 +0200
commit964b3746b9c81e65887e2ac9a335f181db2bb592 (patch)
tree9afaaac41a1c4f71b359fd6706b88df00e22e7a1
parentd33a764123a8aedb20cd84aeff3b94810ee67c4c (diff)
patch 8.1.1384: using "int" for alloc() often results in compiler warningsv8.1.1384
Problem: Using "int" for alloc() often results in compiler warnings. Solution: Use "size_t" and remove type casts. Remove alloc_check(), Vim only works with 32 bit ints anyway.
-rw-r--r--src/autocmd.c8
-rw-r--r--src/buffer.c4
-rw-r--r--src/change.c6
-rw-r--r--src/channel.c4
-rw-r--r--src/charset.c4
-rw-r--r--src/debugger.c2
-rw-r--r--src/dict.c5
-rw-r--r--src/diff.c6
-rw-r--r--src/digraph.c2
-rw-r--r--src/edit.c2
-rw-r--r--src/eval.c15
-rw-r--r--src/evalfunc.c20
-rw-r--r--src/ex_cmds.c16
-rw-r--r--src/ex_cmds2.c2
-rw-r--r--src/ex_docmd.c12
-rw-r--r--src/ex_eval.c6
-rw-r--r--src/ex_getln.c14
-rw-r--r--src/fileio.c10
-rw-r--r--src/findfile.c17
-rw-r--r--src/fold.c4
-rw-r--r--src/getchar.c6
-rw-r--r--src/gui.c4
-rw-r--r--src/gui_at_fs.c6
-rw-r--r--src/gui_gtk.c2
-rw-r--r--src/gui_gtk_x11.c9
-rw-r--r--src/gui_motif.c2
-rw-r--r--src/gui_w32.c6
-rw-r--r--src/hashtab.c3
-rw-r--r--src/if_cscope.c22
-rw-r--r--src/if_perlsfio.c2
-rw-r--r--src/if_python3.c2
-rw-r--r--src/if_xcmdsrv.c4
-rw-r--r--src/indent.c2
-rw-r--r--src/insexpand.c4
-rw-r--r--src/main.c6
-rw-r--r--src/mbyte.c4
-rw-r--r--src/memfile.c6
-rw-r--r--src/memline.c22
-rw-r--r--src/menu.c6
-rw-r--r--src/message.c4
-rw-r--r--src/misc1.c12
-rw-r--r--src/misc2.c106
-rw-r--r--src/netbeans.c12
-rw-r--r--src/ops.c51
-rw-r--r--src/option.c16
-rw-r--r--src/os_amiga.c2
-rw-r--r--src/os_mswin.c8
-rw-r--r--src/os_unix.c11
-rw-r--r--src/os_vms.c2
-rw-r--r--src/os_win32.c5
-rw-r--r--src/proto/misc2.pro21
-rw-r--r--src/quickfix.c10
-rw-r--r--src/regexp.c2
-rw-r--r--src/screen.c8
-rw-r--r--src/spell.c12
-rw-r--r--src/spellfile.c4
-rw-r--r--src/syntax.c14
-rw-r--r--src/term.c4
-rw-r--r--src/undo.c13
-rw-r--r--src/usercmd.c2
-rw-r--r--src/userfunc.c8
-rw-r--r--src/version.c4
-rw-r--r--src/winclip.c7
63 files changed, 293 insertions, 322 deletions
diff --git a/src/autocmd.c b/src/autocmd.c
index e6cdb361ed..614bc331f5 100644
--- a/src/autocmd.c
+++ b/src/autocmd.c
@@ -1193,7 +1193,7 @@ do_autocmd_event(
return FAIL;
}
- ap = (AutoPat *)alloc((unsigned)sizeof(AutoPat));
+ ap = (AutoPat *)alloc(sizeof(AutoPat));
if (ap == NULL)
return FAIL;
ap->pat = vim_strnsave(pat, patlen);
@@ -1242,7 +1242,7 @@ do_autocmd_event(
prev_ac = &(ap->cmds);
while ((ac = *prev_ac) != NULL)
prev_ac = &ac->next;
- ac = (AutoCmd *)alloc((unsigned)sizeof(AutoCmd));
+ ac = (AutoCmd *)alloc(sizeof(AutoCmd));
if (ac == NULL)
return FAIL;
ac->cmd = vim_strsave(cmd);
@@ -2303,8 +2303,8 @@ auto_next_pat(
{
name = event_nr2name(apc->event);
s = _("%s Autocommands for \"%s\"");
- sourcing_name = alloc((unsigned)(STRLEN(s)
- + STRLEN(name) + ap->patlen + 1));
+ sourcing_name = alloc(STRLEN(s)
+ + STRLEN(name) + ap->patlen + 1);
if (sourcing_name != NULL)
{
sprintf((char *)sourcing_name, s,
diff --git a/src/buffer.c b/src/buffer.c
index 425c9143a1..d99071674f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2577,7 +2577,7 @@ ExpandBufnames(
/* Make a copy of "pat" and change "^" to "\(^\|[\/]\)". */
if (*pat == '^')
{
- patc = alloc((unsigned)STRLEN(pat) + 11);
+ patc = alloc(STRLEN(pat) + 11);
if (patc == NULL)
return FAIL;
STRCPY(patc, "\\(^\\|[\\/]\\)");
@@ -2634,7 +2634,7 @@ ExpandBufnames(
break;
if (round == 1)
{
- *file = (char_u **)alloc((unsigned)(count * sizeof(char_u *)));
+ *file = (char_u **)alloc(count * sizeof(char_u *));
if (*file == NULL)
{
vim_regfree(regmatch.regprog);
diff --git a/src/change.c b/src/change.c
index b43ba35745..d2aa1530f1 100644
--- a/src/change.c
+++ b/src/change.c
@@ -985,7 +985,7 @@ ins_char_bytes(char_u *buf, int charlen)
}
}
- newp = alloc_check((unsigned)(linelen + newlen - oldlen));
+ newp = alloc(linelen + newlen - oldlen);
if (newp == NULL)
return;
@@ -1060,7 +1060,7 @@ ins_str(char_u *s)
oldp = ml_get(lnum);
oldlen = (int)STRLEN(oldp);
- newp = alloc_check((unsigned)(oldlen + newlen + 1));
+ newp = alloc(oldlen + newlen + 1);
if (newp == NULL)
return;
if (col > 0)
@@ -1213,7 +1213,7 @@ del_bytes(
newp = oldp; // use same allocated memory
else
{ // need to allocate a new line
- newp = alloc((unsigned)(newlen + 1));
+ newp = alloc(newlen + 1);
if (newp == NULL)
return FAIL;
mch_memmove(newp, oldp, (size_t)col);
diff --git a/src/channel.c b/src/channel.c
index 31c9bbe229..1564128efb 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -2024,7 +2024,7 @@ channel_parse_json(channel_T *channel, ch_part_T part)
}
else
{
- item = (jsonq_T *)alloc((unsigned)sizeof(jsonq_T));
+ item = (jsonq_T *)alloc(sizeof(jsonq_T));
if (item == NULL)
clear_tv(&listtv);
else
@@ -2223,7 +2223,7 @@ channel_push_json(channel_T *channel, ch_part_T part, typval_T *rettv)
/* append after the last item that was pushed back */
item = item->jq_next;
- newitem = (jsonq_T *)alloc((unsigned)sizeof(jsonq_T));
+ newitem = (jsonq_T *)alloc(sizeof(jsonq_T));
if (newitem == NULL)
clear_tv(rettv);
else
diff --git a/src/charset.c b/src/charset.c
index cff62e1857..171eccbfce 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -355,10 +355,10 @@ transstr(char_u *s)
len += 4; /* illegal byte sequence */
}
}
- res = alloc((unsigned)(len + 1));
+ res = alloc(len + 1);
}
else
- res = alloc((unsigned)(vim_strsize(s) + 1));
+ res = alloc(vim_strsize(s) + 1);
if (res != NULL)
{
*res = NUL;
diff --git a/src/debugger.c b/src/debugger.c
index 78e32d33dc..b79f61365a 100644
--- a/src/debugger.c
+++ b/src/debugger.c
@@ -873,7 +873,7 @@ debuggy_find(
// Replace K_SNR in function name with "<SNR>".
if (!file && fname[0] == K_SPECIAL)
{
- name = alloc((unsigned)STRLEN(fname) + 3);
+ name = alloc(STRLEN(fname) + 3);
if (name == NULL)
name = fname;
else
diff --git a/src/dict.c b/src/dict.c
index 007a7ff851..6e1d0d640f 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -210,7 +210,7 @@ dictitem_alloc(char_u *key)
{
dictitem_T *di;
- di = (dictitem_T *)alloc((unsigned)(sizeof(dictitem_T) + STRLEN(key)));
+ di = (dictitem_T *)alloc(sizeof(dictitem_T) + STRLEN(key));
if (di != NULL)
{
STRCPY(di->di_key, key);
@@ -228,8 +228,7 @@ dictitem_copy(dictitem_T *org)
{
dictitem_T *di;
- di = (dictitem_T *)alloc((unsigned)(sizeof(dictitem_T)
- + STRLEN(org->di_key)));
+ di = (dictitem_T *)alloc(sizeof(dictitem_T) + STRLEN(org->di_key));
if (di != NULL)
{
STRCPY(di->di_key, org->di_key);
diff --git a/src/diff.c b/src/diff.c
index 38ae0b47c9..3c72e12bf8 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -537,7 +537,7 @@ diff_alloc_new(tabpage_T *tp, diff_T *dprev, diff_T *dp)
{
diff_T *dnew;
- dnew = (diff_T *)alloc((unsigned)sizeof(diff_T));
+ dnew = (diff_T *)alloc(sizeof(diff_T));
if (dnew != NULL)
{
dnew->df_next = dp;
@@ -1123,7 +1123,7 @@ diff_file(diffio_T *dio)
{
len = STRLEN(tmp_orig) + STRLEN(tmp_new)
+ STRLEN(tmp_diff) + STRLEN(p_srr) + 27;
- cmd = alloc((unsigned)len);
+ cmd = alloc(len);
if (cmd == NULL)
return FAIL;
@@ -1218,7 +1218,7 @@ ex_diffpatch(exarg_T *eap)
if (esc_name == NULL)
goto theend;
buflen = STRLEN(tmp_orig) + STRLEN(esc_name) + STRLEN(tmp_new) + 16;
- buf = alloc((unsigned)buflen);
+ buf = alloc(buflen);
if (buf == NULL)
goto theend;
diff --git a/src/digraph.c b/src/digraph.c
index d936136805..a26d10ca05 100644
--- a/src/digraph.c
+++ b/src/digraph.c
@@ -2317,7 +2317,7 @@ keymap_init(void)
/* Source the keymap file. It will contain a ":loadkeymap" command
* which will call ex_loadkeymap() below. */
buflen = STRLEN(curbuf->b_p_keymap) + STRLEN(p_enc) + 14;
- buf = alloc((unsigned)buflen);
+ buf = alloc(buflen);
if (buf == NULL)
return e_outofmem;
diff --git a/src/edit.c b/src/edit.c
index 8a008cbfd4..6e2fdb8448 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -1943,7 +1943,7 @@ change_indent(
{
curwin->w_cursor.col = (colnr_T)new_cursor_col;
i = (int)curwin->w_virtcol - vcol;
- ptr = alloc((unsigned)(i + 1));
+ ptr = alloc(i + 1);
if (ptr != NULL)
{
new_cursor_col += i;
diff --git a/src/eval.c b/src/eval.c
index 6950348999..4796a25bb3 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -5151,7 +5151,7 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
* Copy the string into allocated memory, handling backslashed
* characters.
*/
- name = alloc((unsigned)(p - *arg + extra));
+ name = alloc(p - *arg + extra);
if (name == NULL)
return FAIL;
rettv->v_type = VAR_STRING;
@@ -5285,7 +5285,7 @@ get_lit_string_tv(char_u **arg, typval_T *rettv, int evaluate)
/*
* Copy the string into allocated memory, handling '' to ' reduction.
*/
- str = alloc((unsigned)((p - *arg) - reduce));
+ str = alloc((p - *arg) - reduce);
if (str == NULL)
return FAIL;
rettv->v_type = VAR_STRING;
@@ -6782,8 +6782,8 @@ make_expanded_name(
temp_result = eval_to_string(expr_start + 1, &nextcmd, FALSE);
if (temp_result != NULL && nextcmd == NULL)
{
- retval = alloc((unsigned)(STRLEN(temp_result) + (expr_start - in_start)
- + (in_end - expr_end) + 1));
+ retval = alloc(STRLEN(temp_result) + (expr_start - in_start)
+ + (in_end - expr_end) + 1);
if (retval != NULL)
{
STRCPY(retval, in_start);
@@ -8130,8 +8130,7 @@ set_var(
if (!valid_varname(varname))
return;
- v = (dictitem_T *)alloc((unsigned)(sizeof(dictitem_T)
- + STRLEN(varname)));
+ v = (dictitem_T *)alloc(sizeof(dictitem_T) + STRLEN(varname));
if (v == NULL)
return;
STRCPY(v->di_key, varname);
@@ -8993,7 +8992,7 @@ setwinvar(typval_T *argvars, typval_T *rettv UNUSED, int off)
}
else
{
- winvarname = alloc((unsigned)STRLEN(varname) + 3);
+ winvarname = alloc(STRLEN(varname) + 3);
if (winvarname != NULL)
{
STRCPY(winvarname, "w:");
@@ -9056,7 +9055,7 @@ autoload_name(char_u *name)
char_u *scriptname;
/* Get the script file name: replace '#' with '/', append ".vim". */
- scriptname = alloc((unsigned)(STRLEN(name) + 14));
+ scriptname = alloc(STRLEN(name) + 14);
if (scriptname == NULL)
return FALSE;
STRCPY(scriptname, "autoload/");
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 6ffd1a1abf..58ea7103fc 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -4272,10 +4272,10 @@ f_foldtext(typval_T *argvars UNUSED, typval_T *rettv)
}
count = (long)(foldend - foldstart + 1);
txt = NGETTEXT("+-%s%3ld line: ", "+-%s%3ld lines: ", count);
- r = alloc((unsigned)(STRLEN(txt)
- + STRLEN(dashes) /* for %s */
- + 20 /* for %3ld */
- + STRLEN(s))); /* concatenated */
+ r = alloc(STRLEN(txt)
+ + STRLEN(dashes) // for %s
+ + 20 // for %3ld
+ + STRLEN(s)); // concatenated
if (r != NULL)
{
sprintf((char *)r, txt, dashes, count);
@@ -10386,7 +10386,7 @@ f_resolve(typval_T *argvars, typval_T *rettv)
if (q > p && !mch_isFullName(buf))
{
/* symlink is relative to directory of argument */
- cpy = alloc((unsigned)(STRLEN(p) + STRLEN(buf) + 1));
+ cpy = alloc(STRLEN(p) + STRLEN(buf) + 1);
if (cpy != NULL)
{
STRCPY(cpy, p);
@@ -11067,8 +11067,8 @@ do_searchpair(
/* Make two search patterns: start/end (pat2, for in nested pairs) and
* start/middle/end (pat3, for the top pair). */
- pat2 = alloc((unsigned)(STRLEN(spat) + STRLEN(epat) + 17));
- pat3 = alloc((unsigned)(STRLEN(spat) + STRLEN(mpat) + STRLEN(epat) + 25));
+ pat2 = alloc(STRLEN(spat) + STRLEN(epat) + 17);
+ pat3 = alloc(STRLEN(spat) + STRLEN(mpat) + STRLEN(epat) + 25);
if (pat2 == NULL || pat3 == NULL)
goto theend;
sprintf((char *)pat2, "\\m\\(%s\\m\\)\\|\\(%s\\m\\)", spat, epat);
@@ -11328,7 +11328,7 @@ f_setbufvar(typval_T *argvars, typval_T *rettv UNUSED)
{
buf_T *save_curbuf = curbuf;
- bufvarname = alloc((unsigned)STRLEN(varname) + 3);
+ bufvarname = alloc(STRLEN(varname) + 3);
if (bufvarname != NULL)
{
curbuf = buf;
@@ -11850,7 +11850,7 @@ f_settabvar(typval_T *argvars, typval_T *rettv)
save_curtab = curtab;
goto_tabpage_tp(tp, FALSE, FALSE);
- tabvarname = alloc((unsigned)STRLEN(varname) + 3);
+ tabvarname = alloc(STRLEN(varname) + 3);
if (tabvarname != NULL)
{
STRCPY(tabvarname, "t:");
@@ -13921,7 +13921,7 @@ get_cmd_output_as_rettv(
++i;
end = res + i;
- s = alloc((unsigned)(end - start + 1));
+ s = alloc(end - start + 1);
if (s == NULL)
goto errret;
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 040514cdc5..7420d6752a 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -595,10 +595,10 @@ ex_sort(exarg_T *eap)
}
/* Allocate a buffer that can hold the longest line. */
- sortbuf1 = alloc((unsigned)maxlen + 1);
+ sortbuf1 = alloc(maxlen + 1);
if (sortbuf1 == NULL)
goto sortend;
- sortbuf2 = alloc((unsigned)maxlen + 1);
+ sortbuf2 = alloc(maxlen + 1);
if (sortbuf2 == NULL)
goto sortend;
@@ -1146,7 +1146,7 @@ do_bang(
}
len += (int)STRLEN(prevcmd);
}
- if ((t = alloc((unsigned)len)) == NULL)
+ if ((t = alloc(len)) == NULL)
{
vim_free(newcmd);
return;
@@ -1209,7 +1209,7 @@ do_bang(
*/
if (*p_shq != NUL)
{
- newcmd = alloc((unsigned)(STRLEN(prevcmd) + 2 * STRLEN(p_shq) + 1));
+ newcmd = alloc(STRLEN(prevcmd) + 2 * STRLEN(p_shq) + 1);
if (newcmd == NULL)
return;
STRCPY(newcmd, p_shq);
@@ -3908,7 +3908,7 @@ do_ecmd(
len = (int)STRLEN(command) + 3;
else
len = 30;
- p = alloc((unsigned)len);
+ p = alloc(len);
if (p != NULL)
{
if (command != NULL)
@@ -5634,7 +5634,7 @@ do_sub(exarg_T *eap)
* too many calls to alloc()/free()).
*/
new_start_len = needed_len + 50;
- if ((new_start = alloc_check(new_start_len)) == NULL)
+ if ((new_start = alloc(new_start_len)) == NULL)
goto outofmem;
*new_start = NUL;
new_end = new_start;
@@ -5651,7 +5651,7 @@ do_sub(exarg_T *eap)
if (needed_len > (int)new_start_len)
{
new_start_len = needed_len + 50;
- if ((p1 = alloc_check(new_start_len)) == NULL)
+ if ((p1 = alloc(new_start_len)) == NULL)
{
vim_free(new_start);
goto outofmem;
@@ -7320,7 +7320,7 @@ helptags_one(
got_int = TRUE;
break;
}
- s = alloc((unsigned)(p2 - p1 + STRLEN(fname) + 2));
+ s = alloc(p2 - p1 + STRLEN(fname) + 2);
if (s == NULL)
{
got_int = TRUE;
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 59452032bd..c56e305336 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -2366,7 +2366,7 @@ ex_compiler(exarg_T *eap)
}
else
{
- buf = alloc((unsigned)(STRLEN(eap->arg) + 14));
+ buf = alloc(STRLEN(eap->arg) + 14);
if (buf != NULL)
{
if (eap->forceit)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index f4f7639e77..c6e00bec51 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -5094,7 +5094,7 @@ repl_cmdline(
i = (int)(src - *cmdlinep) + (int)STRLEN(src + srclen) + len + 3;
if (eap->nextcmd != NULL)
i += (int)STRLEN(eap->nextcmd);/* add space for next command */
- if ((new_cmdline = alloc((unsigned)i)) == NULL)
+ if ((new_cmdline = alloc(i)) == NULL)
return NULL; /* out of memory! */
/*
@@ -6547,7 +6547,7 @@ alist_unlink(alist_T *al)
void
alist_new(void)
{
- curwin->w_alist = (alist_T *)alloc((unsigned)sizeof(alist_T));
+ curwin->w_alist = (alist_T *)alloc(sizeof(alist_T));
if (curwin->w_alist == NULL)
{
curwin->w_alist = &global_alist;
@@ -6581,7 +6581,7 @@ alist_expand(int *fnum_list, int fnum_len)
* expansion. Also, the vimrc file isn't read yet, thus the user
* can't set the options. */
p_su = empty_option;
- old_arg_files = (char_u **)alloc((unsigned)(sizeof(char_u *) * GARGCOUNT));
+ old_arg_files = (char_u **)alloc(sizeof(char_u *) * GARGCOUNT);
if (old_arg_files != NULL)
{
for (i = 0; i < GARGCOUNT; ++i)
@@ -8839,7 +8839,7 @@ ex_normal(exarg_T *eap)
}
if (len > 0)
{
- arg = alloc((unsigned)(STRLEN(eap->arg) + len + 1));
+ arg = alloc(STRLEN(eap->arg) + len + 1);
if (arg != NULL)
{
len = 0;
@@ -9628,7 +9628,7 @@ arg_all(void)
}
/* allocate memory */
- retval = alloc((unsigned)len + 1);
+ retval = alloc(len + 1);
if (retval == NULL)
break;
}
@@ -10622,7 +10622,7 @@ get_view_file(int c)
for (p = sname; *p; ++p)
if (*p == '=' || vim_ispathsep(*p))
++len;
- retval = alloc((unsigned)(STRLEN(sname) + len + STRLEN(p_vdir) + 9));
+ retval = alloc(STRLEN(sname) + len + STRLEN(p_vdir) + 9);
if (retval != NULL)
{
STRCPY(retval, p_vdir);
diff --git a/src/ex_eval.c b/src/ex_eval.c
index 63bca67180..b1bb7e5ddb 100644
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -251,7 +251,7 @@ cause_errthrow(
while (*plist != NULL)
plist = &(*plist)->next;
- elem = (struct msglist *)alloc((unsigned)sizeof(struct msglist));
+ elem = (struct msglist *)alloc(sizeof(struct msglist));
if (elem == NULL)
{
suppress_errthrow = TRUE;
@@ -519,7 +519,7 @@ throw_exception(void *value, except_type_T type, char_u *cmdname)
}
}
- excp = (except_T *)alloc((unsigned)sizeof(except_T));
+ excp = (except_T *)alloc(sizeof(except_T));
if (excp == NULL)
goto nomem;
@@ -1441,7 +1441,7 @@ ex_try(exarg_T *eap)
{
eslist_T *elem;
- elem = (eslist_T *)alloc((unsigned)sizeof(struct eslist_elem));
+ elem = (eslist_T *)alloc(sizeof(struct eslist_elem));
if (elem == NULL)
emsg(_(e_outofmem));
else
diff --git a/src/ex_getln.c b/src/ex_getln.c
index ba3dc7358a..00193fee88 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4154,7 +4154,7 @@ ExpandOne(
}
}
- ss = alloc((unsigned)len + 1);
+ ss = alloc(len + 1);
if (ss)
vim_strncpy(ss, xp->xp_files[0], (size_t)len);
findex = -1; /* next p_wc gets first one */
@@ -4362,7 +4362,7 @@ escape_fname(char_u **pp)
{
char_u *p;
- p = alloc((unsigned)(STRLEN(*pp) + 2));
+ p = alloc(STRLEN(*pp) + 2);
if (p != NULL)
{
p[0] = '\\';
@@ -5294,7 +5294,7 @@ ExpandGeneric(
if (count == 0)
return OK;
*num_file = count;
- *file = (char_u **)alloc((unsigned)(count * sizeof(char_u *)));
+ *file = (char_u **)alloc(count * sizeof(char_u *));
if (*file == NULL)
{
*file = (char_u **)"";
@@ -5636,7 +5636,7 @@ ExpandRTDir(
for (i = 0; dirnames[i] != NULL; ++i)
{
- s = alloc((unsigned)(STRLEN(dirnames[i]) + pat_len + 7));
+ s = alloc(STRLEN(dirnames[i]) + pat_len + 7);
if (s == NULL)
{
ga_clear_strings(&ga);
@@ -5650,7 +5650,7 @@ ExpandRTDir(
if (flags & DIP_START) {
for (i = 0; dirnames[i] != NULL; ++i)
{
- s = alloc((unsigned)(STRLEN(dirnames[i]) + pat_len + 22));
+ s = alloc(STRLEN(dirnames[i]) + pat_len + 22);
if (s == NULL)
{
ga_clear_strings(&ga);
@@ -5665,7 +5665,7 @@ ExpandRTDir(
if (flags & DIP_OPT) {
for (i = 0; dirnames[i] != NULL; ++i)
{
- s = alloc((unsigned)(STRLEN(dirnames[i]) + pat_len + 20));
+ s = alloc(STRLEN(dirnames[i]) + pat_len + 20);
if (s == NULL)
{
ga_clear_strings(&ga);
@@ -5728,7 +5728,7 @@ ExpandPackAddDir(
pat_len = (int)STRLEN(pat);
ga_init2(&ga, (int)sizeof(char *), 10);
- s = alloc((unsigned)(pat_len + 26));
+ s = alloc(pat_len + 26);
if (s == NULL)
{
ga_clear_strings(&ga);
diff --git a/src/fileio.c b/src/fileio.c
index 57c5f47fc6..e41f967622 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -6203,7 +6203,7 @@ buf_modname(
*/
if (fname == NULL || *fname == NUL)
{
- retval = alloc((unsigned)(MAXPATHL + extlen + 3));
+ retval = alloc(MAXPATHL + extlen + 3);
if (retval == NULL)
return NULL;
if (mch_dirname(retval, MAXPATHL) == FAIL ||
@@ -6222,7 +6222,7 @@ buf_modname(
else
{
fnamelen = (int)STRLEN(fname);
- retval = alloc((unsigned)(fnamelen + extlen + 3));
+ retval = alloc(fnamelen + extlen + 3);
if (retval == NULL)
return NULL;
STRCPY(retval, fname);
@@ -6894,8 +6894,8 @@ buf_check_timestamp(
{