summaryrefslogtreecommitdiffstats
path: root/src/if_cscope.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-05-24 18:54:09 +0200
committerBram Moolenaar <Bram@vim.org>2019-05-24 18:54:09 +0200
commit964b3746b9c81e65887e2ac9a335f181db2bb592 (patch)
tree9afaaac41a1c4f71b359fd6706b88df00e22e7a1 /src/if_cscope.c
parentd33a764123a8aedb20cd84aeff3b94810ee67c4c (diff)
patch 8.1.1384: using "int" for alloc() often results in compiler warningsv8.1.1384
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.
Diffstat (limited to 'src/if_cscope.c')
-rw-r--r--src/if_cscope.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/if_cscope.c b/src/if_cscope.c
index 93a0458b4f..4d5748910b 100644
--- a/src/if_cscope.c
+++ b/src/if_cscope.c
@@ -466,7 +466,7 @@ cs_add(exarg_T *eap UNUSED)
cs_stat_emsg(char *fname)
{
char *stat_emsg = _("E563: stat(%s) error: %d");
- char *buf = (char *)alloc((unsigned)strlen(stat_emsg) + MAXPATHL + 10);
+ char *buf = (char *)alloc(strlen(stat_emsg) + MAXPATHL + 10);
if (buf != NULL)
{
@@ -543,7 +543,7 @@ staterr:
/* if filename is a directory, append the cscope database name to it */
if (S_ISDIR(statbuf.st_mode))
{
- fname2 = (char *)alloc((unsigned)(strlen(CSCOPE_DBFILE) + strlen(fname) + 2));
+ fname2 = (char *)alloc(strlen(CSCOPE_DBFILE) + strlen(fname) + 2);
if (fname2 == NULL)
goto add_err;
@@ -769,7 +769,7 @@ cs_create_cmd(char *csoption, char *pattern)
while VIM_ISWHITE(*pat)
++pat;
- if ((cmd = (char *)alloc((unsigned)(strlen(pat) + 2))) == NULL)
+ if ((cmd = (char *)alloc(strlen(pat) + 2)) == NULL)
return NULL;
(void)sprintf(cmd, "%d%s", search, pat);
@@ -1121,7 +1121,7 @@ cs_find_common(
if (strchr(CSQF_FLAGS, *qfpos) == NULL)
{
char *nf = _("E469: invalid cscopequickfix flag %c for %c");
- char *buf = (char *)alloc((unsigned)strlen(nf));
+ char *buf = (char *)alloc(strlen(nf));
/* strlen will be enough because we use chars */
if (buf != NULL)
@@ -1192,7 +1192,7 @@ cs_find_common(
return FALSE;
}
- buf = (char *)alloc((unsigned)(strlen(opt) + strlen(pat) + strlen(nf)));
+ buf = (char *)alloc(strlen(opt) + strlen(pat) + strlen(nf));
if (buf == NULL)
(void)emsg(nf);
else
@@ -1450,14 +1450,14 @@ cs_insert_filelist(
clear_csinfo(j);
}
- if ((csinfo[i].fname = (char *)alloc((unsigned)strlen(fname)+1)) == NULL)
+ if ((csinfo[i].fname = (char *)alloc(strlen(fname)+1)) == NULL)
return -1;
(void)strcpy(csinfo[i].fname, (const char *)fname);
if (ppath != NULL)
{
- if ((csinfo[i].ppath = (char *)alloc((unsigned)strlen(ppath) + 1)) == NULL)
+ if ((csinfo[i].ppath = (char *)alloc(strlen(ppath) + 1)) == NULL)
{
VIM_CLEAR(csinfo[i].fname);
return -1;
@@ -1468,7 +1468,7 @@ cs_insert_filelist(
if (flags != NULL)
{
- if ((csinfo[i].flags = (char *)alloc((unsigned)strlen(flags) + 1)) == NULL)
+ if ((csinfo[i].flags = (char *)alloc(strlen(flags) + 1)) == NULL)
{
VIM_CLEAR(csinfo[i].fname);
VIM_CLEAR(csinfo[i].ppath);
@@ -1820,7 +1820,7 @@ cs_file_results(FILE *f, int *nummatches_a)
&slno, &search)) == NULL)
continue;
- context = (char *)alloc((unsigned)strlen(cntx)+5);
+ context = (char *)alloc(strlen(cntx)+5);
if (context == NULL)
continue;
@@ -1975,7 +1975,7 @@ cs_print_tags_priv(char **matches, char **cntxts, int num_matches)
assert(num_matches > 0);
- if ((tbuf = (char *)alloc((unsigned)strlen(matches[0]) + 1)) == NULL)
+ if ((tbuf = (char *)alloc(strlen(matches[0]) + 1)) == NULL)
return;
strcpy(tbuf, matches[0]);
@@ -2010,7 +2010,7 @@ cs_print_tags_priv(char **matches, char **cntxts, int num_matches)
* by parsing matches[i] on the fly and placing stuff into buf
* directly, but that's too much of a hassle
*/
- if ((tbuf = (char *)alloc((unsigned)strlen(matches[idx]) + 1)) == NULL)
+ if ((tbuf = (char *)alloc(strlen(matches[idx]) + 1)) == NULL)
continue;
(void)strcpy(tbuf, matches[idx]);