summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9e7dda6)
raw | patch | inline | side by side (parent: 9e7dda6)
author | Max Kellermann <max@duempel.org> | |
Wed, 17 Sep 2008 10:29:07 +0000 (12:29 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Wed, 17 Sep 2008 10:29:07 +0000 (12:29 +0200) |
src/list_window.c | patch | blob | history | |
src/list_window.h | patch | blob | history | |
src/main.c | patch | blob | history | |
src/mpdclient.c | patch | blob | history | |
src/mpdclient.h | patch | blob | history | |
src/screen.c | patch | blob | history | |
src/screen.h | patch | blob | history | |
src/screen_file.c | patch | blob | history | |
src/screen_play.c | patch | blob | history | |
src/screen_search.c | patch | blob | history |
diff --git a/src/list_window.c b/src/list_window.c
index ad671f0cf51ad1a36715e6e1623731d36cb1acc5..5ab8f9c9c125c5ecc628fd050a6de932de327fb8 100644 (file)
--- a/src/list_window.c
+++ b/src/list_window.c
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
if (lw->selected + lw->rows < length)
lw->selected += lw->rows - 1;
else
- return list_window_last(lw, length);
+ list_window_last(lw, length);
}
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) {
g_free(state);
}
-
- return NULL;
}
void
diff --git a/src/list_window.h b/src/list_window.h
index 3a9fba4c313cb5bda9d3ea3d0e592f42c6eb952e..ca93971dde2aa5146242a1b1f9c2ed79a96a804e 100644 (file)
--- a/src/list_window.h
+++ b/src/list_window.h
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);
/* 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 d54fd37179f813504e3e5a9c5439879ce8689b90..c2d752ffbed5c03af0442ac87ed0ae3ec557ff04 100644 (file)
--- a/src/main.c
+++ b/src/main.c
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 ae4a7618faf8567d8589ee541936d635d11ebdf5..f67b09133949ff0efcb78eda00b384de699214c9 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
return c;
}
-mpdclient_t *
+void
mpdclient_free(mpdclient_t *c)
{
mpdclient_disconnect(c);
g_list_free(c->playlist_callbacks);
g_list_free(c->browse_callbacks);
g_free(c);
-
- return NULL;
}
gint
/*** 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;
filelist->list = NULL;
filelist->length = 0;
g_free(filelist);
-
- return NULL;
}
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;
{
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 2ce803e86f5f34c42f2717d1bb6d207fa6234cab..0698cbf452061511ae97699f827ff23b5e1f4823 100644 (file)
--- a/src/mpdclient.h
+++ b/src/mpdclient.h
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);
/*** 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 0c59d6940ea36d82024c828885c443ac003aebea..276500bd4b57e31bcf600d3106e896d2e511cb78 100644 (file)
--- a/src/screen.c
+++ b/src/screen.c
wnoutrefresh(w);
}
-int
+void
screen_exit(void)
{
guint i;
string_list_free(screen.find_history);
g_free(screen.buf);
g_free(screen.findbuf);
-
- return 0;
}
void
refresh();
}
-int
+void
screen_init(mpdclient_t *c)
{
guint i;
/* 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 3f335bf219893c6c021afc2d0dc6d3a03eeac9be..b9087e0ca3091248cd1eec7136b0e4cb533b1be5 100644 (file)
--- a/src/screen.h
+++ b/src/screen.h
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 16f9352428def6157fa9c36ac244a4657462f338..d40c8edc9739094a1a6fcfaed2970a7a35d6c092 100644 (file)
--- a/src/screen_file.c
+++ b/src/screen_file.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);
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 d257ec1dbabdb11bf9a42095879840e821d1d905..1f844f943956d1514dd685e76a743b016f977325 100644 (file)
--- a/src/screen_play.c
+++ b/src/screen_play.c
return songname;
}
-static int
+static void
center_playing_item(mpdclient_t *c)
{
unsigned length = c->playlist.list->len;
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);
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 e199bfb2b476ecd1f647f2256bf44ade991f88c3..ce23b9098880613994f8fdfb76591c2578bb2606 100644 (file)
--- a/src/screen_search.c
+++ b/src/screen_search.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);
}
if (mpdclient_finish_command(c) && fl)
- fl = mpdclient_filelist_free(fl);
+ mpdclient_filelist_free(fl);
fl->updated = TRUE;
}
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) {