diff options
author | monsta <[email protected]> | 2015-12-02 13:11:19 +0300 |
---|---|---|
committer | monsta <[email protected]> | 2015-12-07 11:12:01 +0300 |
commit | 0b334ce4e863b227054237beb3d4064e7893f3b6 (patch) | |
tree | e4fd926daa5f844836b2c0570e288485afb2f3c7 | |
parent | dc66bdf36dc19c363aebdbe6d46598921bd4f64b (diff) | |
download | mate-terminal-0b334ce4e863b227054237beb3d4064e7893f3b6.tar.bz2 mate-terminal-0b334ce4e863b227054237beb3d4064e7893f3b6.tar.xz |
simplify some code, get rid of excessive data conversions
-rw-r--r-- | src/terminal-util.c | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/src/terminal-util.c b/src/terminal-util.c index 320afd1..cc14584 100644 --- a/src/terminal-util.c +++ b/src/terminal-util.c @@ -37,8 +37,6 @@ #include <X11/Xatom.h> #endif -#include <libmate-desktop/mate-gsettings.h> - #include "terminal-accels.h" #include "terminal-app.h" #include "terminal-intl.h" @@ -606,30 +604,23 @@ static void setup_ignore_host_env (GHashTable *env_table, GSettings *settings) { - GSList *ignore; - gchar **ignore_strv = g_settings_get_strv (settings, "ignore-hosts"); + gchar **ignore = g_settings_get_strv (settings, "ignore-hosts"); + if (ignore == NULL) + return; - ignore = mate_gsettings_strv_to_gslist ((const gchar *const *)ignore_strv); - if (ignore) + GString *buf = g_string_sized_new (64); + int i; + + for (i = 0; ignore[i] != NULL; ++i) { - GString *buf = g_string_sized_new (64); - while (ignore != NULL) - { - GSList *old; + if (buf->len) + g_string_append_c (buf, ','); + g_string_append (buf, ignore[i]); + } - if (buf->len) - g_string_append_c (buf, ','); - g_string_append (buf, ignore->data); + set_proxy_env (env_table, "no_proxy", g_string_free (buf, FALSE)); - old = ignore; - ignore = g_slist_next (ignore); - g_free (old->data); - g_slist_free_1 (old); - } - set_proxy_env (env_table, "no_proxy", g_string_free (buf, FALSE)); - } - if (ignore_strv) - g_strfreev(ignore_strv); + g_strfreev(ignore); } static void |