Mercurial > vim
diff src/quickfix.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 | 8f0ea605ec96 |
children | 695d9ef00b03 |
line wrap: on
line diff
--- a/src/quickfix.c +++ b/src/quickfix.c @@ -1346,7 +1346,7 @@ qf_parse_multiline_pfx( 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 @@ locstack_queue_delreq(qf_info_T *qi) { 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 @@ qf_add_entry( 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 @@ qf_push_dir(char_u *dirbuf, struct dir_s 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 @@ get_mef_name(void) else off += 19; - name = alloc((unsigned)STRLEN(p_mef) + 30); + name = alloc(STRLEN(p_mef) + 30); if (name == NULL) break; STRCPY(name, p_mef);