diff options
Diffstat (limited to 'src/file_search.c')
-rw-r--r-- | src/file_search.c | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/src/file_search.c b/src/file_search.c index d4a3e35094..57ff7ad3f4 100644 --- a/src/file_search.c +++ b/src/file_search.c @@ -280,8 +280,6 @@ vim_findfile_init ( search_ctx = search_ctx_arg; else { search_ctx = (ff_search_ctx_T*)alloc((unsigned)sizeof(ff_search_ctx_T)); - if (search_ctx == NULL) - goto error_return; memset(search_ctx, 0, sizeof(ff_search_ctx_T)); } search_ctx->ffsc_find_what = find_what; @@ -309,8 +307,6 @@ vim_findfile_init ( if (ff_expand_buffer == NULL) { ff_expand_buffer = (char_u*)alloc(MAXPATHL); - if (ff_expand_buffer == NULL) - goto error_return; } /* Store information on starting dir now if path is relative. @@ -382,32 +378,30 @@ vim_findfile_init ( search_ctx->ffsc_stopdirs_v = (char_u **)alloc((unsigned)sizeof(char_u *)); - if (search_ctx->ffsc_stopdirs_v != NULL) { - do { - char_u *helper; - void *ptr; - - helper = walker; - ptr = xrealloc(search_ctx->ffsc_stopdirs_v, - (dircount + 1) * sizeof(char_u *)); - search_ctx->ffsc_stopdirs_v = ptr; - walker = vim_strchr(walker, ';'); - if (walker) { - search_ctx->ffsc_stopdirs_v[dircount-1] = - vim_strnsave(helper, (int)(walker - helper)); - walker++; - } else - /* this might be "", which means ascent till top - * of directory tree. - */ - search_ctx->ffsc_stopdirs_v[dircount-1] = - vim_strsave(helper); + do { + char_u *helper; + void *ptr; + + helper = walker; + ptr = xrealloc(search_ctx->ffsc_stopdirs_v, + (dircount + 1) * sizeof(char_u *)); + search_ctx->ffsc_stopdirs_v = ptr; + walker = vim_strchr(walker, ';'); + if (walker) { + search_ctx->ffsc_stopdirs_v[dircount-1] = + vim_strnsave(helper, (int)(walker - helper)); + walker++; + } else + /* this might be "", which means ascent till top + * of directory tree. + */ + search_ctx->ffsc_stopdirs_v[dircount-1] = + vim_strsave(helper); - dircount++; + dircount++; - } while (walker != NULL); - search_ctx->ffsc_stopdirs_v[dircount-1] = NULL; - } + } while (walker != NULL); + search_ctx->ffsc_stopdirs_v[dircount-1] = NULL; } search_ctx->ffsc_level = level; @@ -1074,8 +1068,6 @@ static ff_visited_list_hdr_T *ff_get_visited_list(char_u *filename, ff_visited_l * if we reach this we didn't find a list and we have to allocate new list */ retptr = (ff_visited_list_hdr_T*)alloc((unsigned)sizeof(*retptr)); - if (retptr == NULL) - return NULL; retptr->ffvl_visited_list = NULL; retptr->ffvl_filename = vim_strsave(filename); @@ -1212,8 +1204,6 @@ static ff_stack_T *ff_create_stack_element(char_u *fix_part, char_u *wc_part, in ff_stack_T *new; new = (ff_stack_T *)alloc((unsigned)sizeof(ff_stack_T)); - if (new == NULL) - return NULL; new->ffs_prev = NULL; new->ffs_filearray = NULL; |