cleanup environment variable handling + unit tests

* removed a putenv() implementation which isn't needed anymore
  * mch_getenv() and mch_setenv() are now functions in src/os/env.c
  * removes direct calls to getenv() and setenv() outside of src/os/env.c
  * refactored the logic of get_env_name into mch_getenvname_at_index
  * added unittests for the functions in os/env.c
This commit is contained in:
Stefan Hoffmann
2014-03-03 20:02:32 +01:00
committed by Thiago de Arruda
parent fc86866402
commit f2433aedc8
16 changed files with 207 additions and 250 deletions

View File

@@ -89,6 +89,7 @@
#include "screen.h"
#include "spell.h"
#include "ui.h"
#include "os/os.h"
# define WINBYTE BYTE
@@ -3483,9 +3484,9 @@ char_u * enc_locale() {
# if defined(HAVE_LOCALE_H) || defined(X_LOCALE)
if ((s = setlocale(LC_CTYPE, NULL)) == NULL || *s == NUL)
# endif
if ((s = getenv("LC_ALL")) == NULL || *s == NUL)
if ((s = getenv("LC_CTYPE")) == NULL || *s == NUL)
s = getenv("LANG");
if ((s = (char *)mch_getenv("LC_ALL")) == NULL || *s == NUL)
if ((s = (char *)mch_getenv("LC_CTYPE")) == NULL || *s == NUL)
s = (char *)mch_getenv("LANG");
if (s == NULL || *s == NUL)
return FAIL;