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/quickfix.c b/src/quickfix.c
index cf3b274..46eae2d 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -1346,7 +1346,7 @@
if (*fields->errmsg && !qfl->qf_multiignore)
{
len = (int)STRLEN(qfprev->qf_text);
- if ((ptr = alloc((unsigned)(len + STRLEN(fields->errmsg) + 2)))
+ if ((ptr = alloc(len + STRLEN(fields->errmsg) + 2))
== NULL)
return QF_FAIL;
STRCPY(ptr, qfprev->qf_text);
@@ -1890,7 +1890,7 @@
{
qf_delq_T *q;
- q = (qf_delq_T *)alloc((unsigned)sizeof(qf_delq_T));
+ q = (qf_delq_T *)alloc(sizeof(qf_delq_T));
if (q != NULL)
{
q->qi = qi;
@@ -2063,7 +2063,7 @@
qfline_T *qfp;
qfline_T **lastp; // pointer to qf_last or NULL
- if ((qfp = (qfline_T *)alloc((unsigned)sizeof(qfline_T))) == NULL)
+ if ((qfp = (qfline_T *)alloc(sizeof(qfline_T))) == NULL)
return QF_FAIL;
if (bufnum != 0)
{
@@ -2429,7 +2429,7 @@
struct dir_stack_T *ds_ptr;
// allocate new stack element and hook it in
- ds_new = (struct dir_stack_T *)alloc((unsigned)sizeof(struct dir_stack_T));
+ ds_new = (struct dir_stack_T *)alloc(sizeof(struct dir_stack_T));
if (ds_new == NULL)
return NULL;
@@ -4707,7 +4707,7 @@
else
off += 19;
- name = alloc((unsigned)STRLEN(p_mef) + 30);
+ name = alloc(STRLEN(p_mef) + 30);
if (name == NULL)
break;
STRCPY(name, p_mef);