Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
16763:fccf84413b53 | 16764:ef00b6bc186b |
---|---|
1344 if (qfprev == NULL) | 1344 if (qfprev == NULL) |
1345 return QF_FAIL; | 1345 return QF_FAIL; |
1346 if (*fields->errmsg && !qfl->qf_multiignore) | 1346 if (*fields->errmsg && !qfl->qf_multiignore) |
1347 { | 1347 { |
1348 len = (int)STRLEN(qfprev->qf_text); | 1348 len = (int)STRLEN(qfprev->qf_text); |
1349 if ((ptr = alloc((unsigned)(len + STRLEN(fields->errmsg) + 2))) | 1349 if ((ptr = alloc(len + STRLEN(fields->errmsg) + 2)) |
1350 == NULL) | 1350 == NULL) |
1351 return QF_FAIL; | 1351 return QF_FAIL; |
1352 STRCPY(ptr, qfprev->qf_text); | 1352 STRCPY(ptr, qfprev->qf_text); |
1353 vim_free(qfprev->qf_text); | 1353 vim_free(qfprev->qf_text); |
1354 qfprev->qf_text = ptr; | 1354 qfprev->qf_text = ptr; |
1888 static void | 1888 static void |
1889 locstack_queue_delreq(qf_info_T *qi) | 1889 locstack_queue_delreq(qf_info_T *qi) |
1890 { | 1890 { |
1891 qf_delq_T *q; | 1891 qf_delq_T *q; |
1892 | 1892 |
1893 q = (qf_delq_T *)alloc((unsigned)sizeof(qf_delq_T)); | 1893 q = (qf_delq_T *)alloc(sizeof(qf_delq_T)); |
1894 if (q != NULL) | 1894 if (q != NULL) |
1895 { | 1895 { |
1896 q->qi = qi; | 1896 q->qi = qi; |
1897 q->next = qf_delq_head; | 1897 q->next = qf_delq_head; |
1898 qf_delq_head = q; | 1898 qf_delq_head = q; |
2061 int valid) // valid entry | 2061 int valid) // valid entry |
2062 { | 2062 { |
2063 qfline_T *qfp; | 2063 qfline_T *qfp; |
2064 qfline_T **lastp; // pointer to qf_last or NULL | 2064 qfline_T **lastp; // pointer to qf_last or NULL |
2065 | 2065 |
2066 if ((qfp = (qfline_T *)alloc((unsigned)sizeof(qfline_T))) == NULL) | 2066 if ((qfp = (qfline_T *)alloc(sizeof(qfline_T))) == NULL) |
2067 return QF_FAIL; | 2067 return QF_FAIL; |
2068 if (bufnum != 0) | 2068 if (bufnum != 0) |
2069 { | 2069 { |
2070 buf_T *buf = buflist_findnr(bufnum); | 2070 buf_T *buf = buflist_findnr(bufnum); |
2071 | 2071 |
2427 { | 2427 { |
2428 struct dir_stack_T *ds_new; | 2428 struct dir_stack_T *ds_new; |
2429 struct dir_stack_T *ds_ptr; | 2429 struct dir_stack_T *ds_ptr; |
2430 | 2430 |
2431 // allocate new stack element and hook it in | 2431 // allocate new stack element and hook it in |
2432 ds_new = (struct dir_stack_T *)alloc((unsigned)sizeof(struct dir_stack_T)); | 2432 ds_new = (struct dir_stack_T *)alloc(sizeof(struct dir_stack_T)); |
2433 if (ds_new == NULL) | 2433 if (ds_new == NULL) |
2434 return NULL; | 2434 return NULL; |
2435 | 2435 |
2436 ds_new->next = *stackptr; | 2436 ds_new->next = *stackptr; |
2437 *stackptr = ds_new; | 2437 *stackptr = ds_new; |
4705 if (start == -1) | 4705 if (start == -1) |
4706 start = mch_get_pid(); | 4706 start = mch_get_pid(); |
4707 else | 4707 else |
4708 off += 19; | 4708 off += 19; |
4709 | 4709 |
4710 name = alloc((unsigned)STRLEN(p_mef) + 30); | 4710 name = alloc(STRLEN(p_mef) + 30); |
4711 if (name == NULL) | 4711 if (name == NULL) |
4712 break; | 4712 break; |
4713 STRCPY(name, p_mef); | 4713 STRCPY(name, p_mef); |
4714 sprintf((char *)name + (p - p_mef), "%d%d", start, off); | 4714 sprintf((char *)name + (p - p_mef), "%d%d", start, off); |
4715 STRCAT(name, p + 2); | 4715 STRCAT(name, p + 2); |