[Xfce4-commits] <xfce4-weather-plugin:master> Replace getenv/setenv in my_timegm with their GLIB wrappers.

Harald Judt noreply at xfce.org
Wed Aug 15 12:12:01 CEST 2012


Updating branch refs/heads/master
         to 1b5db7a01a1be02ef088ac2defb76fd962c3267b (commit)
       from 8bd0e2dac81f0e5ac84e56cbfe08398b540b296f (commit)

commit 1b5db7a01a1be02ef088ac2defb76fd962c3267b
Author: Guido Berhoerster <gber at opensuse.org>
Date:   Wed Aug 15 12:05:32 2012 +0200

    Replace getenv/setenv in my_timegm with their GLIB wrappers.
    
    This should make my_timegm even more portable.

 panel-plugin/weather-parsers.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/panel-plugin/weather-parsers.c b/panel-plugin/weather-parsers.c
index c4afe39..1a0e6a2 100644
--- a/panel-plugin/weather-parsers.c
+++ b/panel-plugin/weather-parsers.c
@@ -45,22 +45,22 @@
 
 /*
  * This is a portable replacement for the deprecated timegm(),
- * copied from the man page.
+ * copied from the man page and modified to use GLIB functions.
  */
 static time_t
 my_timegm(struct tm *tm)
 {
     time_t ret;
-    char *tz;
+    const char *tz;
 
-    tz = getenv("TZ");
-    setenv("TZ", "", 1);
+    tz = g_getenv("TZ");
+    g_setenv("TZ", "", 1);
     tzset();
     ret = mktime(tm);
     if (tz)
-        setenv("TZ", tz, 1);
+        g_setenv("TZ", tz, 1);
     else
-        unsetenv("TZ");
+        g_unsetenv("TZ");
     tzset();
     return ret;
 }


More information about the Xfce4-commits mailing list