summaryrefslogtreecommitdiff
path: root/libpiano
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@gmail.com>2008-06-12 15:53:54 +0200
committerLars-Dominik Braun <PromyLOPh@gmail.com>2008-06-12 15:53:54 +0200
commitaff2ce1e5755f87293135ebf9f3995313c05cec9 (patch)
tree23e609bf485bb9945bb795b560ad65e550b57e1b /libpiano
parenta8a3258f0ad08330834a6e844e7a5451dd9e43c9 (diff)
downloadpianobar-windows-aff2ce1e5755f87293135ebf9f3995313c05cec9.tar.gz
pianobar-windows-aff2ce1e5755f87293135ebf9f3995313c05cec9.tar.bz2
pianobar-windows-aff2ce1e5755f87293135ebf9f3995313c05cec9.zip
lib: Split DestroyStations
Diffstat (limited to 'libpiano')
-rw-r--r--libpiano/main.c16
-rw-r--r--libpiano/piano.h2
2 files changed, 15 insertions, 3 deletions
diff --git a/libpiano/main.c b/libpiano/main.c
index 52d7a1b..8ec19bb 100644
--- a/libpiano/main.c
+++ b/libpiano/main.c
@@ -84,6 +84,18 @@ void PianoDestroySearchResult (PianoSearchResult_t *searchResult) {
}
}
+/* free single station
+ * @author PromyLOPh
+ * @added 2008-06-12
+ * @public yes
+ * @param station
+ */
+void PianoDestroyStation (PianoStation_t *station) {
+ free (station->name);
+ free (station->id);
+ memset (station, 0, sizeof (station));
+}
+
/* free complete station list
* @author PromyLOPh
* @added 2008-06-09
@@ -94,11 +106,9 @@ void PianoDestroyStations (PianoHandle_t *ph) {
curStation = ph->stations;
while (curStation != NULL) {
- free (curStation->name);
- free (curStation->id);
lastStation = curStation;
curStation = curStation->next;
- memset (lastStation, 0, sizeof (*lastStation));
+ PianoDestroyStation (lastStation);
free (lastStation);
}
ph->stations = NULL;
diff --git a/libpiano/piano.h b/libpiano/piano.h
index bbe0a9e..9f2f7d7 100644
--- a/libpiano/piano.h
+++ b/libpiano/piano.h
@@ -145,6 +145,8 @@ void PianoInit (PianoHandle_t *);
void PianoDestroy (PianoHandle_t *);
void PianoDestroyPlaylist (PianoHandle_t *ph);
void PianoDestroySearchResult (PianoSearchResult_t *searchResult);
+void PianoDestroyStation (PianoStation_t *station);
+void PianoDestroyStations (PianoHandle_t *ph);
void PianoConnect (PianoHandle_t *, char *, char *);
void PianoGetStations (PianoHandle_t *ph);