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.
This commit is contained in:
Mark Bainter
2015-04-12 22:31:00 +00:00
parent 08c08ecdf3
commit a7e17de048
6 changed files with 121 additions and 156 deletions

View File

@@ -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;
}