Invert sense of conditions involving g_setenv() since its return value

is different than that of setenv().  Also, convert last remaining uses of 
   setenv() to g_setenv().


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13594 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Chris Shoemaker 2006-03-11 01:23:43 +00:00
parent f3cbe0ce05
commit 5fd25c0154
3 changed files with 5 additions and 8 deletions

View File

@ -391,13 +391,13 @@ gnc_timegm (struct tm *tm)
old_tz = getenv ("TZ"); old_tz = getenv ("TZ");
/* FIXME: there's no way to report this error to the caller. */ /* FIXME: there's no way to report this error to the caller. */
if(g_setenv("TZ", "UTC", 1) != 0) if (!g_setenv("TZ", "UTC", 1))
PERR ("couldn't switch the TZ."); PERR ("couldn't switch the TZ.");
result = mktime (tm); result = mktime (tm);
if(old_tz) if(old_tz)
{ {
/* FIXME: there's no way to report this error to the caller. */ /* FIXME: there's no way to report this error to the caller. */
if(g_setenv("TZ", old_tz, 1) != 0) if (!g_setenv("TZ", old_tz, 1))
PERR ("couldn't switch the TZ back."); PERR ("couldn't switch the TZ back.");
} }
else else

View File

@ -11,9 +11,6 @@
#include "test-engine-stuff.h" #include "test-engine-stuff.h"
#include "test-file-stuff.h" #include "test-file-stuff.h"
#ifndef HAVE_SETENV
#include "setenv.h"
#endif
#include "gnc-engine.h" #include "gnc-engine.h"
#include "TransLog.h" #include "TransLog.h"
@ -94,7 +91,7 @@ test_file(const char *filename)
return g_strdup_printf("qof_session_load errorid %d", err); return g_strdup_printf("qof_session_load errorid %d", err);
} }
if(setenv("LANG", possible_envs[i], 1) != 0) if (!g_setenv("LANG", possible_envs[i], 1))
return g_strdup_printf("setenv for LANG"); return g_strdup_printf("setenv for LANG");
new_session = qof_session_new(); new_session = qof_session_new();
@ -166,7 +163,7 @@ main(int argc, char **argv)
break; break;
} }
if(setenv("LANG", base_env, 1) != 0) if (!g_setenv("LANG", base_env, 1))
{ {
failure_args("setenv", __FILE__, __LINE__, failure_args("setenv", __FILE__, __LINE__,
"setenv of LANG failed"); "setenv of LANG failed");

View File

@ -140,7 +140,7 @@ gnc_module_system_setup_load_path(void)
} }
g_list_free(dirs); g_list_free(dirs);
if(g_setenv("LD_LIBRARY_PATH", envt, 1) != 0) if (!g_setenv("LD_LIBRARY_PATH", envt, 1))
{ {
g_warning ("gnc-module failed to set LD_LIBRARY_PATH"); g_warning ("gnc-module failed to set LD_LIBRARY_PATH");
} }