aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_getln.c
diff options
context:
space:
mode:
authorMark Bainter <mbainter+github@gmail.com>2015-04-12 22:31:00 +0000
committerMark Bainter <mbainter+github@gmail.com>2015-04-18 21:37:10 +0000
commita7e17de048b0791329cf1ad4d4c291290a99040a (patch)
tree39381ae903acab0bf818c7cce68fce1997d29255 /src/nvim/ex_getln.c
parent08c08ecdf3c4837889d837dbe4a3ace0bd301ead (diff)
downloadrneovim-a7e17de048b0791329cf1ad4d4c291290a99040a.tar.gz
rneovim-a7e17de048b0791329cf1ad4d4c291290a99040a.tar.bz2
rneovim-a7e17de048b0791329cf1ad4d4c291290a99040a.zip
Refactor get_env() to respect const qualifier
Without the casts*, the compiler rightly warns about the os_getenv losing the qualifier. This refactor adds a variable to manage this properly, and renames the original variables to increase clarity.
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r--src/nvim/ex_getln.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 0e54c0e983..6b395350f3 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -3825,7 +3825,6 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file,
char_u *pat;
int i;
char_u *path;
- bool mustfree = false;
garray_T ga;
char_u *buf = xmalloc(MAXPATHL);
size_t l;
@@ -3849,7 +3848,7 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file,
|| (pat[1] == '.' && vim_ispathsep(pat[2])))))
path = (char_u *)".";
else {
- path = (char_u *)vim_getenv("PATH", &mustfree);
+ path = (char_u *)vim_getenv("PATH");
if (path == NULL)
path = (char_u *)"";
}
@@ -3900,8 +3899,7 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file,
xfree(buf);
xfree(pat);
- if (mustfree)
- xfree(path);
+ xfree(path);
}
/*