[Xfce4-commits] <xfce4-weather-plugin:master> Reformat source code: weather-parsers

Harald Judt noreply at xfce.org
Thu Jul 26 16:12:06 CEST 2012


Updating branch refs/heads/master
         to 392cc48961b0ae62e4a1258c052bf406d6091742 (commit)
       from 5ed1aac89d5d2f3ef808d099f359e27c58c7d16f (commit)

commit 392cc48961b0ae62e4a1258c052bf406d6091742
Author: Harald Judt <h.judt at gmx.at>
Date:   Thu Jul 26 16:09:39 2012 +0200

    Reformat source code: weather-parsers

 panel-plugin/weather-parsers.c |  491 +++++++++++++++++++++-------------------
 panel-plugin/weather-parsers.h |  131 ++++++-----
 2 files changed, 322 insertions(+), 300 deletions(-)

diff --git a/panel-plugin/weather-parsers.c b/panel-plugin/weather-parsers.c
index dc47805..7de38eb 100644
--- a/panel-plugin/weather-parsers.c
+++ b/panel-plugin/weather-parsers.c
@@ -19,9 +19,11 @@
 #include <config.h>
 #endif
 
-/* The following two defines fix compile warnings and need to be
+/*
+ * The following two defines fix compile warnings and need to be
  * before time.h and libxfce4panel.h (which includes glib.h).
- * Otherwise, they will be ignored. */
+ * Otherwise, they will be ignored.
+ */
 #define _XOPEN_SOURCE
 #define _XOPEN_SOURCE_EXTENDED 1
 #include "weather-parsers.h"
@@ -30,273 +32,288 @@
 #include <stdlib.h>
 #include <string.h>
 
-static time_t my_timegm(struct tm *tm)
+
+/*
+ * This is a portable replacement for the deprecated timegm(),
+ * copied from the man page.
+ */
+static time_t
+my_timegm(struct tm *tm)
 {
-	time_t ret;
-	char *tz;
-
-	tz = getenv("TZ");
-	setenv("TZ", "", 1);
-	tzset();
-	ret = mktime(tm);
-	if (tz)
-		setenv("TZ", tz, 1);
-	else
-		unsetenv("TZ");
-	tzset();
-	return ret;
+    time_t ret;
+    char *tz;
+
+    tz = getenv("TZ");
+    setenv("TZ", "", 1);
+    tzset();
+    ret = mktime(tm);
+    if (tz)
+        setenv("TZ", tz, 1);
+    else
+        unsetenv("TZ");
+    tzset();
+    return ret;
 }
 
+
 xml_weather *
-parse_weather (xmlNode *cur_node)
+parse_weather(xmlNode *cur_node)
 {
-  xml_weather *ret;
-  xmlNode     *child_node;
-  guint        i = 0;
+    xml_weather *ret;
+    xmlNode *child_node;
+    guint i = 0;
 
-  if (!NODE_IS_TYPE (cur_node, "weatherdata"))
-    {
-      return NULL;
+    if (!NODE_IS_TYPE(cur_node, "weatherdata")) {
+        return NULL;
     }
 
-  if ((ret = g_slice_new0 (xml_weather)) == NULL)
-    return NULL;
-
-  ret->num_timeslices = 0;
-  for (cur_node = cur_node->children; cur_node; cur_node = cur_node->next)
-    {
-      if (cur_node->type != XML_ELEMENT_NODE)
-        continue;
-
-      if (NODE_IS_TYPE (cur_node, "product"))
-        {
-	  gchar *class = xmlGetProp (cur_node, (const xmlChar *) "class");
-	  if (xmlStrcasecmp(class, "pointData")) {
-		xmlFree(class);
-		continue;
-	  }
-	  g_free(class);
-          for (child_node = cur_node->children; child_node;
-               child_node = child_node->next)
-            {
-              if (NODE_IS_TYPE (child_node, "time"))
-                {
-                  parse_time(child_node, ret);
-                }
+    if ((ret = g_slice_new0(xml_weather)) == NULL)
+        return NULL;
+
+    ret->num_timeslices = 0;
+    for (cur_node = cur_node->children; cur_node; cur_node = cur_node->next) {
+        if (cur_node->type != XML_ELEMENT_NODE)
+            continue;
+
+        if (NODE_IS_TYPE(cur_node, "product")) {
+            gchar *class = xmlGetProp(cur_node, (const xmlChar *) "class");
+            if (xmlStrcasecmp(class, "pointData")) {
+                xmlFree(class);
+                continue;
             }
+            g_free(class);
+            for (child_node = cur_node->children; child_node;
+                 child_node = child_node->next)
+                if (NODE_IS_TYPE(child_node, "time"))
+                    parse_time(child_node, ret);
         }
     }
-
-  return ret;
+    return ret;
 }
 
-void parse_time (xmlNode * cur_node, xml_weather * data) {
-	gchar *datatype = xmlGetProp (cur_node, (const xmlChar *) "datatype");
-	gchar *start = xmlGetProp (cur_node, (const xmlChar *) "from");
-	gchar *end = xmlGetProp (cur_node, (const xmlChar *) "to");
-	struct tm start_tm, end_tm;
-	time_t start_t, end_t;
-	xml_time *timeslice;
-	xmlNode *child_node;
 
+void
+parse_time(xmlNode * cur_node,
+           xml_weather * data)
+{
+    gchar *datatype = xmlGetProp(cur_node, (const xmlChar *) "datatype");
+    gchar *start = xmlGetProp(cur_node, (const xmlChar *) "from");
+    gchar *end = xmlGetProp(cur_node, (const xmlChar *) "to");
+    struct tm start_tm, end_tm;
+    time_t start_t, end_t;
+    xml_time *timeslice;
+    xmlNode *child_node;
+
+    /* strptime needs an initialized struct, or unpredictable
+       behaviour might occur */
     memset(&start_tm, 0, sizeof(struct tm));
     memset(&end_tm, 0, sizeof(struct tm));
     start_tm.tm_isdst = -1;
     end_tm.tm_isdst = -1;
 
-	if (xmlStrcasecmp(datatype, "forecast")) {
-		xmlFree(datatype);
-		xmlFree(start);
-		xmlFree(end);
-		return;
-	}
-
-	xmlFree(datatype);
-
-	if (strptime(start, "%Y-%m-%dT%H:%M:%SZ", &start_tm) == NULL) {
-		xmlFree(start);
-		xmlFree(end);
-		return;
-	}
-
-	if (strptime(end, "%Y-%m-%dT%H:%M:%SZ", &end_tm) == NULL) {
-		xmlFree(start);
-		xmlFree(end);
-		return;
-	}
-
-	xmlFree(start);
-	xmlFree(end);
-
-	start_t = my_timegm(&start_tm);
-	end_t = my_timegm(&end_tm);
-	
-	timeslice = get_timeslice(data, start_t, end_t);
-	
-	if (!timeslice) {
-		g_warning("no timeslice");
-		return;
-	}
-	for (child_node = cur_node->children; child_node;
-	     child_node = child_node->next) {
-		if (NODE_IS_TYPE (child_node, "location")) {
-			if (timeslice->location == NULL)
-				timeslice->location =
-					g_slice_new0(xml_location);
-			parse_location(child_node, timeslice->location);
-		}
-	}
+    if (xmlStrcasecmp(datatype, "forecast")) {
+        xmlFree(datatype);
+        xmlFree(start);
+        xmlFree(end);
+        return;
+    }
+
+    xmlFree(datatype);
+
+    if (strptime(start, "%Y-%m-%dT%H:%M:%SZ", &start_tm) == NULL) {
+        xmlFree(start);
+        xmlFree(end);
+        return;
+    }
+
+    if (strptime(end, "%Y-%m-%dT%H:%M:%SZ", &end_tm) == NULL) {
+        xmlFree(start);
+        xmlFree(end);
+        return;
+    }
+
+    xmlFree(start);
+    xmlFree(end);
+
+    start_t = my_timegm(&start_tm);
+    end_t = my_timegm(&end_tm);
+
+    timeslice = get_timeslice(data, start_t, end_t);
+
+    if (!timeslice) {
+        g_warning("no timeslice");
+        return;
+    }
+    for (child_node = cur_node->children; child_node;
+         child_node = child_node->next)
+        if (NODE_IS_TYPE (child_node, "location")) {
+            if (timeslice->location == NULL)
+                timeslice->location = g_slice_new0(xml_location);
+            parse_location(child_node, timeslice->location);
+        }
 }
 
-xml_time *get_timeslice(xml_weather *data, time_t start_t, time_t end_t)
+
+xml_time *
+get_timeslice(xml_weather *data,
+              time_t start_t,
+              time_t end_t)
 {
-	int i;
-	for (i = 0; i < data->num_timeslices; i++) {
-		if (data->timeslice[i]->start == start_t
-		 && data->timeslice[i]->end == end_t)
-			return data->timeslice[i];
-	}
-	if (data->num_timeslices == MAX_TIMESLICE -1)
-		return NULL;
-
-	data->timeslice[data->num_timeslices] = g_slice_new0(xml_time);
-	data->timeslice[data->num_timeslices]->start = start_t;
-	data->timeslice[data->num_timeslices]->end = end_t;
-	data->num_timeslices++;
-
-	return data->timeslice[data->num_timeslices - 1];
+    int i;
+    for (i = 0; i < data->num_timeslices; i++) {
+        if (data->timeslice[i]->start == start_t &&
+            data->timeslice[i]->end == end_t)
+            return data->timeslice[i];
+    }
+    if (data->num_timeslices == MAX_TIMESLICE -1)
+        return NULL;
+
+    data->timeslice[data->num_timeslices] = g_slice_new0(xml_time);
+    data->timeslice[data->num_timeslices]->start = start_t;
+    data->timeslice[data->num_timeslices]->end = end_t;
+    data->num_timeslices++;
+
+    return data->timeslice[data->num_timeslices - 1];
 }
 
-void parse_location (xmlNode * cur_node, xml_location *loc)
+
+void
+parse_location(xmlNode * cur_node,
+               xml_location *loc)
 {
-	xmlNode *child_node;
-
-	g_free(loc->altitude);
-	loc->altitude = PROP(cur_node, "altitude");
-
-	g_free(loc->latitude);
-	loc->latitude = PROP(cur_node, "latitude");
-
-	g_free(loc->longitude);
-	loc->longitude = PROP(cur_node, "longitude");
-
-	for (child_node = cur_node->children; child_node;
-	     child_node = child_node->next) {
-		if (NODE_IS_TYPE (child_node, "temperature")) {
-			g_free(loc->temperature_unit);
-			g_free(loc->temperature_value);
-			loc->temperature_unit = PROP(child_node, "unit");
-			loc->temperature_value = PROP(child_node, "value");
-		}
-		if (NODE_IS_TYPE (child_node, "windDirection")) {
-			g_free(loc->wind_dir_deg);
-			g_free(loc->wind_dir_name);
-			loc->wind_dir_deg = PROP(child_node, "deg");
-			loc->wind_dir_name = PROP(child_node, "name");
-		}
-		if (NODE_IS_TYPE (child_node, "windSpeed")) {
-			g_free(loc->wind_speed_mps);
-			g_free(loc->wind_speed_beaufort);
-			loc->wind_speed_mps = PROP(child_node, "mps");
-			loc->wind_speed_beaufort = PROP(child_node, "beaufort");
-		}
-		if (NODE_IS_TYPE (child_node, "humidity")) {
-			g_free(loc->humidity_unit);
-			g_free(loc->humidity_value);
-			loc->humidity_unit = PROP(child_node, "unit");
-			loc->humidity_value = PROP(child_node, "value");
-		}
-		if (NODE_IS_TYPE (child_node, "pressure")) {
-			g_free(loc->pressure_unit);
-			g_free(loc->pressure_value);
-			loc->pressure_unit = PROP(child_node, "unit");
-			loc->pressure_value = PROP(child_node, "value");
-		}
-		if (NODE_IS_TYPE (child_node, "cloudiness")) {
-			g_free(loc->clouds_percent[CLOUDS_PERC_CLOUDINESS]);
-			loc->clouds_percent[CLOUDS_PERC_CLOUDINESS] = PROP(child_node, "percent");
-		}
-		if (NODE_IS_TYPE (child_node, "fog")) {
-			g_free(loc->fog_percent);
-			loc->fog_percent = PROP(child_node, "percent");
-		}
-		if (NODE_IS_TYPE (child_node, "lowClouds")) {
-			g_free(loc->clouds_percent[CLOUDS_PERC_LOW]);
-			loc->clouds_percent[CLOUDS_PERC_LOW] = PROP(child_node, "percent");
-		}
-		if (NODE_IS_TYPE (child_node, "mediumClouds")) {
-			g_free(loc->clouds_percent[CLOUDS_PERC_MED]);
-			loc->clouds_percent[CLOUDS_PERC_MED] = PROP(child_node, "percent");
-		}
-		if (NODE_IS_TYPE (child_node, "highClouds")) {
-			g_free(loc->clouds_percent[CLOUDS_PERC_HIGH]);
-			loc->clouds_percent[CLOUDS_PERC_HIGH] = PROP(child_node, "percent");
-		}
-		if (NODE_IS_TYPE (child_node, "precipitation")) {
-			g_free(loc->precipitation_unit);
-			g_free(loc->precipitation_value);
-			loc->precipitation_unit = PROP(child_node, "unit");
-			loc->precipitation_value = PROP(child_node, "value");
-		}
-		if (NODE_IS_TYPE (child_node, "symbol")) {
-			g_free(loc->symbol);
-			loc->symbol = PROP(child_node, "id");
-			loc->symbol_id = strtol(PROP(child_node, "number"), NULL, 10);
-		}
-	}
+    xmlNode *child_node;
+
+    g_free(loc->altitude);
+    loc->altitude = PROP(cur_node, "altitude");
+
+    g_free(loc->latitude);
+    loc->latitude = PROP(cur_node, "latitude");
+
+    g_free(loc->longitude);
+    loc->longitude = PROP(cur_node, "longitude");
+
+    for (child_node = cur_node->children; child_node;
+         child_node = child_node->next) {
+        if (NODE_IS_TYPE (child_node, "temperature")) {
+            g_free(loc->temperature_unit);
+            g_free(loc->temperature_value);
+            loc->temperature_unit = PROP(child_node, "unit");
+            loc->temperature_value = PROP(child_node, "value");
+        }
+        if (NODE_IS_TYPE (child_node, "windDirection")) {
+            g_free(loc->wind_dir_deg);
+            g_free(loc->wind_dir_name);
+            loc->wind_dir_deg = PROP(child_node, "deg");
+            loc->wind_dir_name = PROP(child_node, "name");
+        }
+        if (NODE_IS_TYPE (child_node, "windSpeed")) {
+            g_free(loc->wind_speed_mps);
+            g_free(loc->wind_speed_beaufort);
+            loc->wind_speed_mps = PROP(child_node, "mps");
+            loc->wind_speed_beaufort = PROP(child_node, "beaufort");
+        }
+        if (NODE_IS_TYPE (child_node, "humidity")) {
+            g_free(loc->humidity_unit);
+            g_free(loc->humidity_value);
+            loc->humidity_unit = PROP(child_node, "unit");
+            loc->humidity_value = PROP(child_node, "value");
+        }
+        if (NODE_IS_TYPE (child_node, "pressure")) {
+            g_free(loc->pressure_unit);
+            g_free(loc->pressure_value);
+            loc->pressure_unit = PROP(child_node, "unit");
+            loc->pressure_value = PROP(child_node, "value");
+        }
+        if (NODE_IS_TYPE (child_node, "cloudiness")) {
+            g_free(loc->clouds_percent[CLOUDS_PERC_CLOUDINESS]);
+            loc->clouds_percent[CLOUDS_PERC_CLOUDINESS] = PROP(child_node, "percent");
+        }
+        if (NODE_IS_TYPE (child_node, "fog")) {
+            g_free(loc->fog_percent);
+            loc->fog_percent = PROP(child_node, "percent");
+        }
+        if (NODE_IS_TYPE (child_node, "lowClouds")) {
+            g_free(loc->clouds_percent[CLOUDS_PERC_LOW]);
+            loc->clouds_percent[CLOUDS_PERC_LOW] = PROP(child_node, "percent");
+        }
+        if (NODE_IS_TYPE (child_node, "mediumClouds")) {
+            g_free(loc->clouds_percent[CLOUDS_PERC_MED]);
+            loc->clouds_percent[CLOUDS_PERC_MED] = PROP(child_node, "percent");
+        }
+        if (NODE_IS_TYPE (child_node, "highClouds")) {
+            g_free(loc->clouds_percent[CLOUDS_PERC_HIGH]);
+            loc->clouds_percent[CLOUDS_PERC_HIGH] = PROP(child_node, "percent");
+        }
+        if (NODE_IS_TYPE (child_node, "precipitation")) {
+            g_free(loc->precipitation_unit);
+            g_free(loc->precipitation_value);
+            loc->precipitation_unit = PROP(child_node, "unit");
+            loc->precipitation_value = PROP(child_node, "value");
+        }
+        if (NODE_IS_TYPE (child_node, "symbol")) {
+            g_free(loc->symbol);
+            loc->symbol = PROP(child_node, "id");
+            loc->symbol_id = strtol(PROP(child_node, "number"), NULL, 10);
+        }
+    }
 }
 
-static void xml_location_free(xml_location *loc)
+
+static void
+xml_location_free(xml_location *loc)
 {
-	g_assert(loc != NULL);
-	if (G_UNLIKELY(loc == NULL))
-		return;
-	g_free(loc->altitude);
-	g_free(loc->latitude);
-	g_free(loc->longitude);
-	g_free(loc->temperature_value);
-	g_free(loc->temperature_unit);
-	g_free(loc->wind_dir_deg);
-	g_free(loc->wind_dir_name);
-	g_free(loc->wind_speed_mps);
-	g_free(loc->wind_speed_beaufort);
-	g_free(loc->humidity_value);
-	g_free(loc->humidity_unit);
-	g_free(loc->pressure_value);
-	g_free(loc->pressure_unit);
-	g_free(loc->clouds_percent[CLOUDS_PERC_LOW]);
-	g_free(loc->clouds_percent[CLOUDS_PERC_MED]);
-	g_free(loc->clouds_percent[CLOUDS_PERC_HIGH]);
-	g_free(loc->clouds_percent[CLOUDS_PERC_CLOUDINESS]);
-	g_free(loc->fog_percent);
-	g_free(loc->precipitation_value);
-	g_free(loc->precipitation_unit);
-	g_free(loc->symbol);
-	g_slice_free (xml_location, loc);
-	loc = NULL;
+    g_assert(loc != NULL);
+    if (G_UNLIKELY(loc == NULL))
+        return;
+    g_free(loc->altitude);
+    g_free(loc->latitude);
+    g_free(loc->longitude);
+    g_free(loc->temperature_value);
+    g_free(loc->temperature_unit);
+    g_free(loc->wind_dir_deg);
+    g_free(loc->wind_dir_name);
+    g_free(loc->wind_speed_mps);
+    g_free(loc->wind_speed_beaufort);
+    g_free(loc->humidity_value);
+    g_free(loc->humidity_unit);
+    g_free(loc->pressure_value);
+    g_free(loc->pressure_unit);
+    g_free(loc->clouds_percent[CLOUDS_PERC_LOW]);
+    g_free(loc->clouds_percent[CLOUDS_PERC_MED]);
+    g_free(loc->clouds_percent[CLOUDS_PERC_HIGH]);
+    g_free(loc->clouds_percent[CLOUDS_PERC_CLOUDINESS]);
+    g_free(loc->fog_percent);
+    g_free(loc->precipitation_value);
+    g_free(loc->precipitation_unit);
+    g_free(loc->symbol);
+    g_slice_free(xml_location, loc);
+    loc = NULL;
 }
 
-void xml_time_free(xml_time *timeslice)
+void
+xml_time_free(xml_time *timeslice)
 {
-  g_assert(timeslice != NULL);
-  if (G_UNLIKELY(timeslice == NULL))
-    return;
-  xml_location_free(timeslice->location);
-  g_slice_free (xml_time, timeslice);
-  timeslice = NULL;
+    g_assert(timeslice != NULL);
+    if (G_UNLIKELY(timeslice == NULL))
+        return;
+    xml_location_free(timeslice->location);
+    g_slice_free(xml_time, timeslice);
+    timeslice = NULL;
 }
 
-void xml_weather_free (xml_weather *data)
+
+void
+xml_weather_free(xml_weather *data)
 {
-  guint i;
-
-  g_assert(data != NULL);
-  if (G_UNLIKELY(data == NULL))
-    return;
-  for (i = 0; i < data->num_timeslices; i++) {
-    xml_time_free(data->timeslice[i]);
-  }
-  xml_time_free(data->current_conditions);
-  g_slice_free (xml_weather, data);
-  data = NULL;
+    guint i;
+
+    g_assert(data != NULL);
+    if (G_UNLIKELY(data == NULL))
+        return;
+    for (i = 0; i < data->num_timeslices; i++) {
+        xml_time_free(data->timeslice[i]);
+    }
+    xml_time_free(data->current_conditions);
+    g_slice_free(xml_weather, data);
+    data = NULL;
 }
diff --git a/panel-plugin/weather-parsers.h b/panel-plugin/weather-parsers.h
index 336bbdc..33361c1 100644
--- a/panel-plugin/weather-parsers.h
+++ b/panel-plugin/weather-parsers.h
@@ -1,5 +1,5 @@
 /*  Copyright (c) 2003-2007 Xfce Development Team
- * 
+ *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
@@ -23,78 +23,83 @@
 #include <libxml/parser.h>
 
 G_BEGIN_DECLS
-#define DATA(node) (gchar *) xmlNodeListGetString(node->doc, node->children, 1)
-#define PROP(node, prop) ((gchar *) xmlGetProp ((node), (const xmlChar *) (prop)))
-#define NODE_IS_TYPE(node, type) xmlStrEqual (node->name, (const xmlChar *) type)
+
+#define DATA(node) \
+    ((gchar *) xmlNodeListGetString(node->doc, node->children, 1))
+#define PROP(node, prop) \
+    ((gchar *) xmlGetProp((node), (const xmlChar *) (prop)))
+#define NODE_IS_TYPE(node, type) \
+    (xmlStrEqual(node->name, (const xmlChar *) type))
+
 #define MAX_TIMESLICE 500
 
-enum
-{
-	CLOUDS_PERC_LOW = 0,
-	CLOUDS_PERC_MED,
-	CLOUDS_PERC_HIGH,
-	CLOUDS_PERC_CLOUDINESS,
-	CLOUDS_PERC_NUM
+enum {
+    CLOUDS_PERC_LOW = 0,
+    CLOUDS_PERC_MED,
+    CLOUDS_PERC_HIGH,
+    CLOUDS_PERC_CLOUDINESS,
+    CLOUDS_PERC_NUM
 };
 
-typedef struct
-{
+typedef struct {
     gchar *altitude;
     gchar *latitude;
     gchar *longitude;
 
-	gchar *temperature_value;
-	gchar *temperature_unit;
-	
-	gchar *wind_dir_deg;
-	gchar *wind_dir_name;
-	gchar *wind_speed_mps;
-	gchar *wind_speed_beaufort;
-
-	gchar *humidity_value;
-	gchar *humidity_unit;
-	
-	gchar *pressure_value;
-	gchar *pressure_unit;
-	
-	gchar *clouds_percent[CLOUDS_PERC_NUM];
-	gchar *fog_percent;
-	
-	gchar *precipitation_value;
-	gchar *precipitation_unit;
-
-	gint   symbol_id;
-	gchar *symbol;
-}
-xml_location;
-
-typedef struct
-{
-	time_t start;
-	time_t end;
-	time_t point;
-	xml_location *location;
-}
-xml_time;
-
-typedef struct
-{
-  xml_time *timeslice[MAX_TIMESLICE];
-  guint num_timeslices;
-  xml_time *current_conditions;
-}
-xml_weather;
-
-xml_weather *parse_weather (xmlNode *cur_node);
-
-void parse_time (xmlNode *cur_node, xml_weather * data);
-
-void parse_location (xmlNode *cur_node, xml_location *location);
-
-xml_time *get_timeslice(xml_weather *data, time_t start_t, time_t end_t);
+    gchar *temperature_value;
+    gchar *temperature_unit;
+
+    gchar *wind_dir_deg;
+    gchar *wind_dir_name;
+    gchar *wind_speed_mps;
+    gchar *wind_speed_beaufort;
+
+    gchar *humidity_value;
+    gchar *humidity_unit;
+
+    gchar *pressure_value;
+    gchar *pressure_unit;
+
+    gchar *clouds_percent[CLOUDS_PERC_NUM];
+    gchar *fog_percent;
+
+    gchar *precipitation_value;
+    gchar *precipitation_unit;
+
+    gint symbol_id;
+    gchar *symbol;
+} xml_location;
+
+typedef struct {
+    time_t start;
+    time_t end;
+    time_t point;
+    xml_location *location;
+} xml_time;
+
+typedef struct {
+    xml_time *timeslice[MAX_TIMESLICE];
+    guint num_timeslices;
+    xml_time *current_conditions;
+} xml_weather;
+
+
+xml_weather *parse_weather(xmlNode *cur_node);
+
+void parse_time(xmlNode *cur_node,
+                xml_weather *data);
+
+void parse_location(xmlNode *cur_node,
+                    xml_location *location);
+
+xml_time *get_timeslice(xml_weather *data,
+                        time_t start_t,
+                        time_t end_t);
 
 void xml_time_free(xml_time *timeslice);
-void xml_weather_free (xml_weather *data);
+
+void xml_weather_free(xml_weather *data);
 
 G_END_DECLS
+
 #endif


More information about the Xfce4-commits mailing list