From 115663c4e2b65a5760b8bb002a97aaf0dcfbb0d9 Mon Sep 17 00:00:00 2001 From: monsta Date: Wed, 13 Jan 2016 10:49:46 +0300 Subject: [PATCH] use g_get_environ from https://git.gnome.org/browse/gnome-terminal/commit?id=a9e294229521d91c916dba765c773fcf85260a5b --- src/terminal.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/terminal.c b/src/terminal.c index e0addf0..a80a58b 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -309,7 +309,7 @@ name_lost_cb (GDBusConnection *connection, OwnData *data = (OwnData *) user_data; GError *error = NULL; char **envv; - int envc, i; + int i; GVariantBuilder builder; GVariant *value; GString *string; @@ -345,21 +345,15 @@ name_lost_cb (GDBusConnection *connection, g_variant_builder_add (&builder, "@ay", string_to_ay (data->options->startup_id)); string = g_string_new (NULL); - envv = g_listenv (); - envc = g_strv_length (envv); - for (i = 0; i < envc; ++i) + envv = g_get_environ (); + for (i = 0; envv[i]; ++i) { - const char *value; - - value = g_getenv (envv[i]); - if (value == NULL) - continue; - if (i > 0) g_string_append_c (string, '\0'); - g_string_append_printf (string, "%s=%s", envv[i], value); + g_string_append (string, envv[i]); } + g_strfreev (envv); len = string->len; s = g_string_free (string, FALSE);