summaryrefslogtreecommitdiff
path: root/src/tag.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-05-28 23:08:19 +0200
committerBram Moolenaar <Bram@vim.org>2019-05-28 23:08:19 +0200
commitc799fe206e61f2e2c1231bc46cbe4bb354f3da69 (patch)
tree68b3d2a8bb82519e29fc95f317d2ee02b07f95fa /src/tag.c
parentb58a4b938c4bc7e0499700859bd7abba9acc5b11 (diff)
downloadvim-git-c799fe206e61f2e2c1231bc46cbe4bb354f3da69.tar.gz
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type castsv8.1.1414
Problem: Alloc() returning "char_u *" causes a lot of type casts. Solution: Have it return "void *". (Mike Williams) Define ALLOC_ONE() to check the simple allocations.
Diffstat (limited to 'src/tag.c')
-rw-r--r--src/tag.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/tag.c b/src/tag.c
index ef2ebbe8f..03587938b 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -1430,7 +1430,7 @@ find_tagfunc_tags(
if (name_only)
mfp = vim_strsave(res_name);
else
- mfp = (char_u *)alloc(sizeof(char_u) + len + 1);
+ mfp = alloc(sizeof(char_u) + len + 1);
if (mfp == NULL)
continue;
@@ -2536,8 +2536,7 @@ parse_line:
*/
*tagp.tagname_end = NUL;
len = (int)(tagp.tagname_end - tagp.tagname);
- mfp = (char_u *)alloc(sizeof(char_u)
- + len + 10 + ML_EXTRA + 1);
+ mfp = alloc(sizeof(char_u) + len + 10 + ML_EXTRA + 1);
if (mfp != NULL)
{
int heuristic;
@@ -2574,7 +2573,7 @@ parse_line:
if (tagp.command + 2 < temp_end)
{
len = (int)(temp_end - tagp.command - 2);
- mfp = (char_u *)alloc(len + 2);
+ mfp = alloc(len + 2);
if (mfp != NULL)
vim_strncpy(mfp, tagp.command + 2, len);
}
@@ -2585,7 +2584,7 @@ parse_line:
else
{
len = (int)(tagp.tagname_end - tagp.tagname);
- mfp = (char_u *)alloc(sizeof(char_u) + len + 1);
+ mfp = alloc(sizeof(char_u) + len + 1);
if (mfp != NULL)
vim_strncpy(mfp, tagp.tagname, len);
@@ -2620,7 +2619,7 @@ parse_line:
else
++len;
#endif
- mfp = (char_u *)alloc(sizeof(char_u) + len + 1);
+ mfp = alloc(sizeof(char_u) + len + 1);
if (mfp != NULL)
{
p = mfp;
@@ -2789,7 +2788,7 @@ findtag_end:
match_count = 0;
if (match_count > 0)
- matches = (char_u **)alloc(match_count * sizeof(char_u *));
+ matches = ALLOC_MULT(char_u *, match_count);
else
matches = NULL;
match_count = 0;