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

@@ -829,18 +829,16 @@ static void init_locale(void)
# endif
{
bool mustfree = false;
char_u *p;
/* expand_env() doesn't work yet, because chartab[] is not initialized
* yet, call vim_getenv() directly */
p = (char_u *)vim_getenv("VIMRUNTIME", &mustfree);
p = (char_u *)vim_getenv("VIMRUNTIME");
if (p != NULL && *p != NUL) {
vim_snprintf((char *)NameBuff, MAXPATHL, "%s/lang", p);
bindtextdomain(VIMPACKAGE, (char *)NameBuff);
}
if (mustfree)
xfree(p);
xfree(p);
textdomain(VIMPACKAGE);
}
TIME_MSG("locale set");