Haiku: Use setenv and unsetenv POSIX functions

The _POSIX_VERSION declared in Haiku is 199009L, so we have
to enable support for setenv/unsetenv explicitly until
Haiku POSIX version is updated.

Change-Id: Ic22374253b0512a6a816257db83b0c649be0585d
Reviewed-by: Augustin Cavalier <waddlesplash@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Tobias Koenig 2015-01-23 07:53:41 +00:00
parent be84381664
commit 7b9b54b114

View File

@ -3159,7 +3159,7 @@ bool qputenv(const char *varName, const QByteArray& value)
{
#if defined(_MSC_VER) && _MSC_VER >= 1400
return _putenv_s(varName, value.constData()) == 0;
#elif defined(_POSIX_VERSION) && (_POSIX_VERSION-0) >= 200112L
#elif (defined(_POSIX_VERSION) && (_POSIX_VERSION-0) >= 200112L) || defined(Q_OS_HAIKU)
// POSIX.1-2001 has setenv
return setenv(varName, value.constData(), true) == 0;
#else
@ -3189,8 +3189,8 @@ bool qunsetenv(const char *varName)
{
#if defined(_MSC_VER) && _MSC_VER >= 1400
return _putenv_s(varName, "") == 0;
#elif (defined(_POSIX_VERSION) && (_POSIX_VERSION-0) >= 200112L) || defined(Q_OS_BSD4)
// POSIX.1-2001 and BSD have unsetenv
#elif (defined(_POSIX_VERSION) && (_POSIX_VERSION-0) >= 200112L) || defined(Q_OS_BSD4) || defined(Q_OS_HAIKU)
// POSIX.1-2001, BSD and Haiku have unsetenv
return unsetenv(varName) == 0;
#elif defined(Q_CC_MINGW)
// On mingw, putenv("var=") removes "var" from the environment