diff src/ex_getln.c @ 16764:ef00b6bc186b v8.1.1384

patch 8.1.1384: using "int" for alloc() often results in compiler warnings commit https://github.com/vim/vim/commit/964b3746b9c81e65887e2ac9a335f181db2bb592 Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 24 18:54:09 2019 +0200 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.
author Bram Moolenaar <Bram@vim.org>
date Fri, 24 May 2019 19:00:07 +0200
parents 77bcb5055fec
children 695d9ef00b03
line wrap: on
line diff
--- 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);