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.
diff --git a/src/os_mswin.c b/src/os_mswin.c
index fc6806d..67989fe 100644
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -1466,8 +1466,8 @@
char_u *port_name = utf16_to_enc(wport_name, NULL);
if (printer_name != NULL && port_name != NULL)
- prt_name = alloc((unsigned)(STRLEN(printer_name)
- + STRLEN(port_name) + STRLEN(text)));
+ prt_name = alloc(STRLEN(printer_name)
+ + STRLEN(port_name) + STRLEN(text));
if (prt_name != NULL)
wsprintf((char *)prt_name, (const char *)text,
printer_name, port_name);
@@ -2111,7 +2111,7 @@
char *err = _(e_invexprmsg);
size_t len = STRLEN(str) + STRLEN(err) + 5;
- res = alloc((unsigned)len);
+ res = alloc(len);
if (res != NULL)
vim_snprintf((char *)res, len, "%s: \"%s\"", err, str);
reply.dwData = COPYDATA_ERROR_RESULT;
@@ -2340,7 +2340,7 @@
char_u *p;
/* Leave enough space for a 9-digit suffix to ensure uniqueness! */
- ok_name = alloc((unsigned)STRLEN(name) + 10);
+ ok_name = alloc(STRLEN(name) + 10);
STRCPY(ok_name, name);
p = ok_name + STRLEN(name);