From 4848158cc12443c27e298b01543bf620172508c3 Mon Sep 17 00:00:00 2001 From: Mark Bainter Date: Sun, 12 Apr 2015 21:17:16 +0000 Subject: Remove char_u: vim_getenv() --- src/nvim/ex_cmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/ex_cmds.c') diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index c57861282d..c40808b1f1 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -5117,7 +5117,7 @@ void fix_help_buffer(void) while (*p != NUL) { copy_option_part(&p, NameBuff, MAXPATHL, ","); mustfree = FALSE; - rt = vim_getenv((char_u *)"VIMRUNTIME", &mustfree); + rt = (char_u *)vim_getenv("VIMRUNTIME", &mustfree); if (path_full_compare(rt, NameBuff, FALSE) != kEqualFiles) { int fcount; char_u **fnames; -- cgit From a7e17de048b0791329cf1ad4d4c291290a99040a Mon Sep 17 00:00:00 2001 From: Mark Bainter Date: Sun, 12 Apr 2015 22:31:00 +0000 Subject: 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. --- src/nvim/ex_cmds.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/nvim/ex_cmds.c') diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index c40808b1f1..efb05d80fb 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -5061,7 +5061,6 @@ void fix_help_buffer(void) char_u *fname; char_u *p; char_u *rt; - bool mustfree; /* set filetype to "help". */ set_option_value((char_u *)"ft", 0L, (char_u *)"help", OPT_LOCAL); @@ -5116,8 +5115,7 @@ void fix_help_buffer(void) p = p_rtp; while (*p != NUL) { copy_option_part(&p, NameBuff, MAXPATHL, ","); - mustfree = FALSE; - rt = (char_u *)vim_getenv("VIMRUNTIME", &mustfree); + rt = (char_u *)vim_getenv("VIMRUNTIME"); if (path_full_compare(rt, NameBuff, FALSE) != kEqualFiles) { int fcount; char_u **fnames; @@ -5242,8 +5240,7 @@ void fix_help_buffer(void) FreeWild(fcount, fnames); } } - if (mustfree) - xfree(rt); + xfree(rt); } break; } -- cgit