Port: replace setenv() by g_setenv()
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 13 Jun 2017 20:10:17 +0000 (20:10 +0000)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 19 Jul 2017 18:13:15 +0000 (14:13 -0400)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
cli/babeltrace.c
include/babeltrace/compat/utc-internal.h
tests/lib/test-plugin-plugins/minimal.c
tests/lib/test_plugin.c

index a058bcebe46273c3638685f84643311a8b565d84..ae8aacfc0322722689f5e0c79c4d1cb82f9fe375 100644 (file)
@@ -2573,9 +2573,9 @@ void set_auto_log_levels(struct bt_config *cfg)
        while (*env_var_name) {
                if (!getenv(*env_var_name)) {
                        if (cfg->verbose) {
-                               setenv(*env_var_name, "I", 1);
+                               g_setenv(*env_var_name, "I", 1);
                        } else if (cfg->debug) {
-                               setenv(*env_var_name, "V", 1);
+                               g_setenv(*env_var_name, "V", 1);
                        } else {
                                char val[2] = { 0 };
 
@@ -2584,7 +2584,7 @@ void set_auto_log_levels(struct bt_config *cfg)
                                 * explicitly specified.
                                 */
                                val[0] = cfg->log_level;
-                               setenv(*env_var_name, val, 1);
+                               g_setenv(*env_var_name, val, 1);
                        }
                }
 
index d78a1885203764f9830dca11b98eccbfb5d0a173..db3035a3ad6ec51b65270e2cbb49c062910e1d1c 100644 (file)
@@ -46,6 +46,7 @@ time_t bt_timegm(struct tm *tm)
 
 #include <string.h>
 #include <stdlib.h>
+#include <glib.h>
 
 /*
  * Note: Below implementation of timegm() is not thread safe
@@ -76,11 +77,11 @@ time_t bt_timegm(struct tm *tm)
        }
 
        /* Temporarily setting TZ to 1 for UTC */
-       setenv("TZ", "", 1);
+       g_setenv("TZ", "", 1);
        tzset();
        ret = mktime(tm);
        if (tz) {
-               setenv("TZ", tz, 1);
+               g_setenv("TZ", tz, 1);
                free(tz);
        } else {
                unsetenv("TZ");
index c78862b0fcaa7247efe6d2f48616b93f91d204eb..6dec80aa5937a94a896b645ca556d1757da9db1a 100644 (file)
 
 static enum bt_plugin_status plugin_init(struct bt_plugin *plugin)
 {
-       setenv("BT_TEST_PLUGIN_INIT_CALLED", "1", 1);
+       g_setenv("BT_TEST_PLUGIN_INIT_CALLED", "1", 1);
        return BT_PLUGIN_STATUS_OK;
 }
 
 static enum bt_plugin_status plugin_exit(void)
 {
-       setenv("BT_TEST_PLUGIN_EXIT_CALLED", "1", 1);
+       g_setenv("BT_TEST_PLUGIN_EXIT_CALLED", "1", 1);
        return BT_PLUGIN_STATUS_OK;
 }
 
index 874a11dbcd7843f3c724a76224faf5287cbab440..1fb3c6ddbd1c9d1478586712db0c9984eaefa54f 100644 (file)
@@ -49,8 +49,8 @@ static int check_env_var(const char *name)
 
 static void reset_test_plugin_env_vars(void)
 {
-       setenv("BT_TEST_PLUGIN_INIT_CALLED", "0", 1);
-       setenv("BT_TEST_PLUGIN_EXIT_CALLED", "0", 1);
+       g_setenv("BT_TEST_PLUGIN_INIT_CALLED", "0", 1);
+       g_setenv("BT_TEST_PLUGIN_EXIT_CALLED", "0", 1);
 }
 
 static char *get_test_plugin_path(const char *plugin_dir,
This page took 0.02734 seconds and 4 git commands to generate.