diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2014-05-22 12:50:59 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-05-22 13:00:51 -0400 |
commit | e2e47803bdfd5fb40e3dbc9cdf798bb27d306c72 (patch) | |
tree | 6ff1b06b5d5fd6d3260f3a778c33cfaf03f0c295 /src/nvim/os_unix.c | |
parent | 0aa8b5828cc0674894681841f40c3c05bfd2f07b (diff) | |
parent | e303a11ebfc352860cce73184ece692ab4d0f01c (diff) | |
download | rneovim-e2e47803bdfd5fb40e3dbc9cdf798bb27d306c72.tar.gz rneovim-e2e47803bdfd5fb40e3dbc9cdf798bb27d306c72.tar.bz2 rneovim-e2e47803bdfd5fb40e3dbc9cdf798bb27d306c72.zip |
Merge #708 'Remove NULL/non-NULL tests after vim_str(n)save'
- replace alloc with xmalloc
Diffstat (limited to 'src/nvim/os_unix.c')
-rw-r--r-- | src/nvim/os_unix.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/nvim/os_unix.c b/src/nvim/os_unix.c index 1669a7cf77..52627b6a8b 100644 --- a/src/nvim/os_unix.c +++ b/src/nvim/os_unix.c @@ -1120,7 +1120,7 @@ int flags; /* EW_* flags */ ++len; } } - command = alloc(len); + command = xmalloc(len); /* * Build the shell command: @@ -1269,7 +1269,7 @@ int flags; /* EW_* flags */ fseek(fd, 0L, SEEK_END); len = ftell(fd); /* get size of temp file */ fseek(fd, 0L, SEEK_SET); - buffer = alloc(len + 1); + buffer = xmalloc(len + 1); i = fread((char *)buffer, 1, len, fd); fclose(fd); os_remove((char *)tempname); @@ -1353,7 +1353,7 @@ int flags; /* EW_* flags */ goto notfound; } *num_file = i; - *file = (char_u **)alloc(sizeof(char_u *) * i); + *file = (char_u **)xmalloc(sizeof(char_u *) * i); /* * Isolate the individual file names. @@ -1397,7 +1397,7 @@ int flags; /* EW_* flags */ if (!dir && (flags & EW_EXEC) && !os_can_exe((*file)[i])) continue; - p = alloc((unsigned)(STRLEN((*file)[i]) + 1 + dir)); + p = xmalloc(STRLEN((*file)[i]) + 1 + dir); STRCPY(p, (*file)[i]); if (dir) add_pathsep(p); /* add '/' to a directory name */ @@ -1437,10 +1437,9 @@ char_u ***file; for (i = 0; i < num_pat; i++) { s = vim_strsave(pat[i]); - if (s != NULL) - /* Be compatible with expand_filename(): halve the number of - * backslashes. */ - backslash_halve(s); + /* Be compatible with expand_filename(): halve the number of + * backslashes. */ + backslash_halve(s); (*file)[i] = s; } *num_file = num_pat; |