aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/list_window.c10
-rw-r--r--src/list_window.h4
-rw-r--r--src/main.c2
-rw-r--r--src/mpdclient.c18
-rw-r--r--src/mpdclient.h4
-rw-r--r--src/screen.c8
-rw-r--r--src/screen.h4
-rw-r--r--src/screen_file.c8
-rw-r--r--src/screen_play.c8
-rw-r--r--src/screen_search.c7
10 files changed, 32 insertions, 41 deletions
diff --git a/src/list_window.c b/src/list_window.c
index ad671f0cf..5ab8f9c9c 100644
--- a/src/list_window.c
+++ b/src/list_window.c
@@ -44,15 +44,13 @@ list_window_init(WINDOW *w, unsigned width, unsigned height)
return lw;
}
-struct list_window *
+void
list_window_free(struct list_window *lw)
{
if (lw) {
memset(lw, 0, sizeof(list_window_t));
g_free(lw);
}
-
- return NULL;
}
void
@@ -148,7 +146,7 @@ list_window_next_page(struct list_window *lw, unsigned length)
if (lw->selected + lw->rows < length)
lw->selected += lw->rows - 1;
else
- return list_window_last(lw, length);
+ list_window_last(lw, length);
}
void
@@ -370,7 +368,7 @@ list_window_init_state(void)
return g_malloc0(sizeof(list_window_state_t));
}
-list_window_state_t *
+void
list_window_free_state(list_window_state_t *state)
{
if (state) {
@@ -389,8 +387,6 @@ list_window_free_state(list_window_state_t *state)
g_free(state);
}
-
- return NULL;
}
void
diff --git a/src/list_window.h b/src/list_window.h
index 3a9fba4c3..ca93971dd 100644
--- a/src/list_window.h
+++ b/src/list_window.h
@@ -36,7 +36,7 @@ struct list_window *list_window_init(WINDOW *w,
unsigned width, unsigned height);
/* destroy a list window (returns NULL) */
-struct list_window *list_window_free(struct list_window *lw);
+void list_window_free(struct list_window *lw);
/* reset a list window (selected=0, start=0, clear=1) */
void list_window_reset(struct list_window *lw);
@@ -87,7 +87,7 @@ list_window_rfind(struct list_window *lw,
/* list window states */
list_window_state_t *list_window_init_state(void);
-list_window_state_t *list_window_free_state(list_window_state_t *state);
+void list_window_free_state(list_window_state_t *state);
void list_window_push_state(list_window_state_t *state,
struct list_window *lw);
bool list_window_pop_state(list_window_state_t *state, struct list_window *lw);
diff --git a/src/main.c b/src/main.c
index d54fd3717..c2d752ffb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -113,7 +113,7 @@ exit_and_cleanup(void)
if( mpd )
{
mpdclient_disconnect(mpd);
- mpd = mpdclient_free(mpd);
+ mpdclient_free(mpd);
}
g_free(options.host);
g_free(options.password);
diff --git a/src/mpdclient.c b/src/mpdclient.c
index ae4a7618f..f67b09133 100644
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
@@ -168,7 +168,7 @@ mpdclient_new(void)
return c;
}
-mpdclient_t *
+void
mpdclient_free(mpdclient_t *c)
{
mpdclient_disconnect(c);
@@ -179,8 +179,6 @@ mpdclient_free(mpdclient_t *c)
g_list_free(c->playlist_callbacks);
g_list_free(c->browse_callbacks);
g_free(c);
-
- return NULL;
}
gint
@@ -738,14 +736,14 @@ mpdclient_playlist_update_changes(mpdclient_t *c)
/*** Filelist functions *****************************************************/
/****************************************************************************/
-mpdclient_filelist_t *
+void
mpdclient_filelist_free(mpdclient_filelist_t *filelist)
{
GList *list = g_list_first(filelist->list);
D("mpdclient_filelist_free()\n");
if (list == NULL)
- return NULL;
+ return;
while (list != NULL) {
filelist_entry_t *entry = list->data;
@@ -760,8 +758,6 @@ mpdclient_filelist_free(mpdclient_filelist_t *filelist)
filelist->list = NULL;
filelist->length = 0;
g_free(filelist);
-
- return NULL;
}
@@ -836,8 +832,10 @@ mpdclient_filelist_search_utf8(mpdclient_t *c,
filelist->length++;
}
- if (mpdclient_finish_command(c))
- return mpdclient_filelist_free(filelist);
+ if (mpdclient_finish_command(c)) {
+ mpdclient_filelist_free(filelist);
+ return NULL;
+ }
filelist->updated = TRUE;
return filelist;
@@ -868,7 +866,7 @@ mpdclient_filelist_update(mpdclient_t *c, mpdclient_filelist_t *filelist)
{
gchar *path = g_strdup(filelist->path);
- filelist = mpdclient_filelist_free(filelist);
+ mpdclient_filelist_free(filelist);
filelist = mpdclient_filelist_get(c, path);
g_free(path);
return filelist;
diff --git a/src/mpdclient.h b/src/mpdclient.h
index 2ce803e86..0698cbf45 100644
--- a/src/mpdclient.h
+++ b/src/mpdclient.h
@@ -52,7 +52,7 @@ gint
mpdclient_finish_command(mpdclient_t *c);
mpdclient_t *mpdclient_new(void);
-mpdclient_t *mpdclient_free(mpdclient_t *c);
+void mpdclient_free(mpdclient_t *c);
gint mpdclient_connect(mpdclient_t *c, gchar *host, gint port,
gfloat timeout, gchar *password);
gint mpdclient_disconnect(mpdclient_t *c);
@@ -133,7 +133,7 @@ void mpdclient_playlist_callback(mpdclient_t *c, int event, gpointer data);
/*** filelist functions ***************************************************/
-mpdclient_filelist_t *mpdclient_filelist_free(mpdclient_filelist_t *filelist);
+void mpdclient_filelist_free(mpdclient_filelist_t *filelist);
mpdclient_filelist_t *mpdclient_filelist_get(mpdclient_t *c, const gchar *path);
mpdclient_filelist_t *mpdclient_filelist_search(mpdclient_t *c,
int exact_match,
diff --git a/src/screen.c b/src/screen.c
index 0c59d6940..276500bd4 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -413,7 +413,7 @@ paint_status_window(mpdclient_t *c)
wnoutrefresh(w);
}
-int
+void
screen_exit(void)
{
guint i;
@@ -434,8 +434,6 @@ screen_exit(void)
string_list_free(screen.find_history);
g_free(screen.buf);
g_free(screen.findbuf);
-
- return 0;
}
void
@@ -620,7 +618,7 @@ ncurses_init(void)
refresh();
}
-int
+void
screen_init(mpdclient_t *c)
{
guint i;
@@ -641,8 +639,6 @@ screen_init(mpdclient_t *c)
/* initialize wreadln */
wrln_wgetch = my_wgetch;
wrln_max_history_length = 16;
-
- return 0;
}
void
diff --git a/src/screen.h b/src/screen.h
index 3f335bf21..b9087e0ca 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -72,8 +72,8 @@ typedef struct screen_functions {
void
ncurses_init(void);
-int screen_init(mpdclient_t *c);
-int screen_exit(void);
+void screen_init(mpdclient_t *c);
+void screen_exit(void);
void screen_resize(void);
void screen_status_message(const char *msg);
void screen_status_printf(const char *format, ...);
diff --git a/src/screen_file.c b/src/screen_file.c
index 16f935242..d40c8edc9 100644
--- a/src/screen_file.c
+++ b/src/screen_file.c
@@ -232,7 +232,7 @@ change_directory(mpd_unused screen_t *screen, mpdclient_t *c,
} else
return -1;
- filelist = mpdclient_filelist_free(filelist);
+ mpdclient_filelist_free(filelist);
filelist = mpdclient_filelist_get(c, path);
sync_highlights(c, filelist);
list_window_check_selected(lw, filelist->length);
@@ -575,9 +575,9 @@ static void
browse_exit(void)
{
if( filelist )
- filelist = mpdclient_filelist_free(filelist);
- lw = list_window_free(lw);
- lw_state = list_window_free_state(lw_state);
+ mpdclient_filelist_free(filelist);
+ list_window_free(lw);
+ list_window_free_state(lw_state);
}
static void
diff --git a/src/screen_play.c b/src/screen_play.c
index d257ec1db..1f844f943 100644
--- a/src/screen_play.c
+++ b/src/screen_play.c
@@ -92,7 +92,7 @@ list_callback(unsigned idx, int *highlight, void *data)
return songname;
}
-static int
+static void
center_playing_item(mpdclient_t *c)
{
unsigned length = c->playlist.list->len;
@@ -101,13 +101,13 @@ center_playing_item(mpdclient_t *c)
if (!lw || !c->song || length<lw->rows ||
IS_STOPPED(c->status->state))
- return 0;
+ return;
/* try to center the song that are playing */
idx = playlist_get_index(c, c->song);
D("Autocenter song id:%d pos:%d index:%d\n", c->song->id,c->song->pos,idx);
if (idx < 0)
- return 0;
+ return;
list_window_center(lw, length, idx);
@@ -115,7 +115,7 @@ center_playing_item(mpdclient_t *c)
lw->selected = lw->start+offset;
list_window_check_selected(lw, length);
- return 0;
+ return;
}
static void
diff --git a/src/screen_search.c b/src/screen_search.c
index e199bfb2b..ce23b9098 100644
--- a/src/screen_search.c
+++ b/src/screen_search.c
@@ -181,7 +181,8 @@ search_clear(mpd_unused screen_t *screen, mpdclient_t *c,
{
if (filelist) {
mpdclient_remove_playlist_callback(c, playlist_changed_callback);
- filelist = mpdclient_filelist_free(filelist);
+ mpdclient_filelist_free(filelist);
+ filelist = NULL;
}
if (clear_pattern && pattern) {
g_free(pattern);
@@ -309,7 +310,7 @@ search_advanced_query(char *query, mpdclient_t *c)
}
if (mpdclient_finish_command(c) && fl)
- fl = mpdclient_filelist_free(fl);
+ mpdclient_filelist_free(fl);
fl->updated = TRUE;
}
@@ -373,7 +374,7 @@ quit(void)
if (search_history)
string_list_free(search_history);
if (filelist)
- filelist = mpdclient_filelist_free(filelist);
+ mpdclient_filelist_free(filelist);
list_window_free(lw);
if (pattern) {