0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.1.1384: using "int" for alloc() often results in compiler warnings

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.
This commit is contained in:
Bram Moolenaar
2019-05-24 18:54:09 +02:00
parent d33a764123
commit 964b3746b9
63 changed files with 293 additions and 322 deletions

View File

@@ -2447,7 +2447,8 @@ strerror(int err)
#endif
/*
* Get name of current directory into buffer 'buf' of length 'len' bytes.
* Get name of current directory into buffer "buf" of length "len" bytes.
* "len" must be at least PATH_MAX.
* Return OK for success, FAIL for failure.
*/
int
@@ -2516,7 +2517,7 @@ mch_FullName(
{
/*
* If the file name has a path, change to that directory for a moment,
* and then do the getwd() (and get back to where we were).
* and then get the directory (and get back to where we were).
* This will get the correct path name with "../" things.
*/
if (p != NULL)
@@ -3124,7 +3125,7 @@ mch_can_exe(char_u *name, char_u **path, int use_path)
p = (char_u *)getenv("PATH");
if (p == NULL || *p == NUL)
return -1;
buf = alloc((unsigned)(STRLEN(name) + STRLEN(p) + 2));
buf = alloc(STRLEN(name) + STRLEN(p) + 2);
if (buf == NULL)
return -1;
@@ -4323,7 +4324,7 @@ build_argv(
/* Break 'shellcmdflag' into white separated parts. This doesn't
* handle quoted strings, they are very unlikely to appear. */
*shcf_tofree = alloc((unsigned)STRLEN(p_shcf) + 1);
*shcf_tofree = alloc(STRLEN(p_shcf) + 1);
if (*shcf_tofree == NULL) /* out of memory */
return FAIL;
s = *shcf_tofree;
@@ -6899,7 +6900,7 @@ mch_expand_wildcards(
&& !mch_can_exe((*file)[i], NULL, !(flags & EW_SHELLCMD)))
continue;
p = alloc((unsigned)(STRLEN((*file)[i]) + 1 + dir));
p = alloc(STRLEN((*file)[i]) + 1 + dir);
if (p)
{
STRCPY(p, (*file)[i]);