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/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 7d1d8d0..17ef6ea 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -429,7 +429,7 @@
* into gui_argv. Freed later in gui_mch_init().
*/
gui_argc = 0;
- gui_argv = (char **)alloc((unsigned)((*argc + 1) * sizeof(char *)));
+ gui_argv = (char **)alloc((*argc + 1) * sizeof(char *));
g_return_if_fail(gui_argv != NULL);
@@ -1544,7 +1544,7 @@
if (info == (guint)TARGET_VIM)
{
- tmpbuf = alloc((unsigned)length + 1);
+ tmpbuf = alloc(length + 1);
if (tmpbuf != NULL)
{
tmpbuf[0] = motion_type;
@@ -1603,7 +1603,7 @@
int l = STRLEN(p_enc);
/* contents: motion_type 'encoding' NUL text */
- tmpbuf = alloc((unsigned)length + l + 2);
+ tmpbuf = alloc(length + l + 2);
if (tmpbuf != NULL)
{
tmpbuf[0] = motion_type;
@@ -2512,8 +2512,7 @@
if (i == count)
{
/* allocate an Atoms array which is one item longer */
- new_atoms = (Atom *)alloc((unsigned)((count + 1)
- * sizeof(Atom)));
+ new_atoms = (Atom *)alloc((count + 1) * sizeof(Atom));
if (new_atoms != NULL)
{
memcpy(new_atoms, existing_atoms, count * sizeof(Atom));