diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-05-28 23:08:19 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-05-28 23:08:19 +0200 |
commit | c799fe206e61f2e2c1231bc46cbe4bb354f3da69 (patch) | |
tree | 68b3d2a8bb82519e29fc95f317d2ee02b07f95fa /src/findfile.c | |
parent | b58a4b938c4bc7e0499700859bd7abba9acc5b11 (diff) | |
download | vim-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/findfile.c')
-rw-r--r-- | src/findfile.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/findfile.c b/src/findfile.c index 2fee35362..39e215255 100644 --- a/src/findfile.c +++ b/src/findfile.c @@ -319,7 +319,7 @@ vim_findfile_init( search_ctx = search_ctx_arg; else { - search_ctx = (ff_search_ctx_T*)alloc(sizeof(ff_search_ctx_T)); + search_ctx = ALLOC_ONE(ff_search_ctx_T); if (search_ctx == NULL) goto error_return; vim_memset(search_ctx, 0, sizeof(ff_search_ctx_T)); @@ -350,7 +350,7 @@ vim_findfile_init( if (ff_expand_buffer == NULL) { - ff_expand_buffer = (char_u*)alloc(MAXPATHL); + ff_expand_buffer = alloc(MAXPATHL); if (ff_expand_buffer == NULL) goto error_return; } @@ -430,7 +430,7 @@ vim_findfile_init( walker++; dircount = 1; - search_ctx->ffsc_stopdirs_v = (char_u **)alloc(sizeof(char_u *)); + search_ctx->ffsc_stopdirs_v = ALLOC_ONE(char_u *); if (search_ctx->ffsc_stopdirs_v != NULL) { @@ -925,7 +925,7 @@ vim_findfile(void *search_ctx_arg) */ if (path_with_url(dirptrs[0])) { - stackp->ffs_filearray = (char_u **)alloc(sizeof(char *)); + stackp->ffs_filearray = ALLOC_ONE(char_u *); if (stackp->ffs_filearray != NULL && (stackp->ffs_filearray[0] = vim_strsave(dirptrs[0])) != NULL) @@ -1283,7 +1283,7 @@ ff_get_visited_list( /* * if we reach this we didn't find a list and we have to allocate new list */ - retptr = (ff_visited_list_hdr_T*)alloc(sizeof(*retptr)); + retptr = ALLOC_ONE(ff_visited_list_hdr_T); if (retptr == NULL) return NULL; @@ -1411,7 +1411,7 @@ ff_check_visited( /* * New file/dir. Add it to the list of visited files/dirs. */ - vp = (ff_visited_T *)alloc(sizeof(ff_visited_T) + STRLEN(ff_expand_buffer)); + vp = alloc(sizeof(ff_visited_T) + STRLEN(ff_expand_buffer)); if (vp != NULL) { @@ -1459,7 +1459,7 @@ ff_create_stack_element( { ff_stack_T *new; - new = (ff_stack_T *)alloc(sizeof(ff_stack_T)); + new = ALLOC_ONE(ff_stack_T); if (new == NULL) return NULL; @@ -2429,7 +2429,7 @@ uniquefy_paths(garray_T *gap, char_u *pattern) mch_dirname(curdir, MAXPATHL); expand_path_option(curdir, &path_ga); - in_curdir = (char_u **)alloc_clear(gap->ga_len * sizeof(char_u *)); + in_curdir = ALLOC_CLEAR_MULT(char_u *, gap->ga_len); if (in_curdir == NULL) goto theend; |