[Gpredict-svn] SF.net SVN: gpredict:[222] trunk/src
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
|
From: <cs...@us...> - 2009-04-03 21:03:25
|
Revision: 222
http://gpredict.svn.sourceforge.net/gpredict/?rev=222&view=rev
Author: csete
Date: 2009-04-03 21:03:23 +0000 (Fri, 03 Apr 2009)
Log Message:
-----------
Added function to free transponder list.
Modified Paths:
--------------
trunk/src/trsp-conf.c
trunk/src/trsp-conf.h
Modified: trunk/src/trsp-conf.c
===================================================================
--- trunk/src/trsp-conf.c 2009-04-03 18:08:52 UTC (rev 221)
+++ trunk/src/trsp-conf.c 2009-04-03 21:03:23 UTC (rev 222)
@@ -42,7 +42,7 @@
/** \brief Read transponder data file.
* \param catnum The catalog number of the satellite to read transponders for.
- * \return A newly allocated GSList containing trsp_t structures.
+ * \return The new transponder list.
*/
GSList *read_tranponders (guint catnum)
{
@@ -54,6 +54,7 @@
gchar **groups;
gsize numgrp,i;
+
name = g_strdup_printf ("%d.trsp", catnum);
confdir = get_conf_dir();
fname = g_strconcat (confdir, G_DIR_SEPARATOR_S,
@@ -137,7 +138,7 @@
g_clear_error (&error);
trsp->invert = FALSE;
}
-
+
/* add transponder to list */
trsplist = g_slist_append (trsplist, trsp);
}
@@ -151,17 +152,36 @@
g_free (confdir);
g_free (fname);
+
return trsplist;
}
/** \brief Write transponder list for satellite.
* \param catnum The catlog number of the satellite.
- * \param transp Pointer to a GSList of trsp_t structures.
+ * \param trsplist Pointer to a GSList of trsp_t structures.
*/
-void write_transponders (guint catnum, GSList *transp)
+void write_transponders (guint catnum, GSList *trsplist)
{
// FIXME
sat_log_log (SAT_LOG_LEVEL_BUG, _("%s: Not implemented!"), __FUNCTION__);
}
+/** \brief Free transponder list.
+ * \param trsplist Pointer to a GSList of trsp_t structures.
+ *
+ * This functions free all memory occupied by the transponder list.
+ */
+void free_transponders (GSList *trsplist)
+{
+ gint i, n;
+ trsp_t *trsp;
+
+ n = g_slist_length (trsplist);
+ for (i = 0; i < n; i++) {
+ trsp = (trsp_t *) g_slist_nth_data (trsplist, i);
+ g_free (trsp->name);
+ g_free (trsp);
+ }
+ g_slist_free (trsplist);
+}
Modified: trunk/src/trsp-conf.h
===================================================================
--- trunk/src/trsp-conf.h 2009-04-03 18:08:52 UTC (rev 221)
+++ trunk/src/trsp-conf.h 2009-04-03 21:03:23 UTC (rev 222)
@@ -45,8 +45,8 @@
/* The actual data would then be a singly linked list with pointers to transponder_t structures */
GSList *read_tranponders (guint catnum);
-void write_transponders (guint catnum, GSList *transp);
+void write_transponders (guint catnum, GSList *trsplist);
+void free_transponders (GSList *trsplist);
-
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|