From a4d13100e67791955eef10876c6784748aff2fed Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 27 Jan 2008 03:48:49 -0500 Subject: [PATCH] use setenv/unsetenv instead of putenv, cuz they are not ugly and confusing wrt memory leaks --- openbox/actions/execute.c | 4 ++++ openbox/openbox.c | 4 ++-- openbox/startupnotify.c | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/openbox/actions/execute.c b/openbox/actions/execute.c index 9ab20d7..a857b1b 100644 --- a/openbox/actions/execute.c +++ b/openbox/actions/execute.c @@ -4,6 +4,10 @@ #include "openbox/screen.h" #include "gettext.h" +#ifdef HAVE_STDLIB_H +# include +#endif + typedef struct { gchar *cmd; gboolean sn; diff --git a/openbox/openbox.c b/openbox/openbox.c index d184143..18c34d2 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -194,7 +194,7 @@ gint main(gint argc, gchar **argv) /* set the DISPLAY environment variable for any lauched children, to the display we're using, so they open in the right place. */ - putenv(g_strdup_printf("DISPLAY=%s", DisplayString(ob_display))); + setenv("DISPLAY", DisplayString(ob_display), TRUE); /* create available cursors */ cursors[OB_CURSOR_NONE] = None; @@ -516,7 +516,7 @@ static void remove_args(gint *argc, gchar **argv, gint index, gint num) static void parse_env() { /* unset this so we don't pass it on unknowingly */ - putenv(g_strdup("DESKTOP_STARTUP_ID")); + unsetenv("DESKTOP_STARTUP_ID"); } static void parse_args(gint *argc, gchar **argv) diff --git a/openbox/startupnotify.c b/openbox/startupnotify.c index e9bb831..e13aa55 100644 --- a/openbox/startupnotify.c +++ b/openbox/startupnotify.c @@ -21,7 +21,9 @@ #include "gettext.h" #include "event.h" -#include +#ifdef HAVE_STDLIB_H +# include +#endif #ifndef USE_LIBSN @@ -264,7 +266,7 @@ void sn_setup_spawn_environment(const gchar *program, const gchar *name, g_direct_equal, (GDestroyNotify)sn_launcher_context_unref); - putenv(g_strdup_printf("DESKTOP_STARTUP_ID=%s", id)); + setenv("DESKTOP_STARTUP_ID", id, TRUE); g_free(desc); } -- 1.9.1