From 1cd28efa96dbc3d49a43d9b12c5b65d493baf949 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 15 Sep 2008 12:09:29 +0200 Subject: [PATCH] remove unused static functions Also remove some commented code and unused function parameters. --- src/libmpdclient.c | 5 +++-- src/list_window.c | 13 ------------- src/list_window.h | 3 --- src/main.c | 7 ------- src/mpdclient.c | 11 ----------- src/options.c | 6 ------ src/screen.c | 1 - src/screen_artist.c | 4 ++-- src/screen_file.c | 2 +- src/screen_help.c | 2 +- src/screen_keydef.c | 2 +- src/screen_lyrics.c | 2 +- src/screen_play.c | 2 +- src/screen_search.c | 2 +- src/screen_utils.c | 8 -------- src/screen_utils.h | 1 - src/src_lyrics.c | 4 ---- src/wreadln.c | 14 ++++++-------- 18 files changed, 17 insertions(+), 72 deletions(-) diff --git a/src/libmpdclient.c b/src/libmpdclient.c index 27bd9ad..65c2e44 100644 --- a/src/libmpdclient.c +++ b/src/libmpdclient.c @@ -295,7 +295,7 @@ void mpd_setConnectionTimeout(mpd_Connection * connection, float timeout) { } static int mpd_parseWelcome(mpd_Connection * connection, const char * host, int port, - char * rt, char * output) { + char * output) { char * tmp; char * test; int i; @@ -398,7 +398,8 @@ mpd_Connection * mpd_newConnection(const char * host, int port, float timeout) { strcpy(connection->buffer,rt+1); connection->buflen = strlen(connection->buffer); - if(mpd_parseWelcome(connection,host,port,rt,output) == 0) connection->doneProcessing = 1; + if(mpd_parseWelcome(connection,host,port,output) == 0) + connection->doneProcessing = 1; free(output); diff --git a/src/list_window.c b/src/list_window.c index db14ff9..2b5fe8c 100644 --- a/src/list_window.c +++ b/src/list_window.c @@ -106,19 +106,6 @@ list_window_previous(list_window_t *lw, int length) lw->selected = length-1; } -void -list_window_right(list_window_t *lw, int length) -{ - lw->xoffset++; -} - -void -list_window_left(list_window_t *lw) -{ - if( lw->xoffset > 0 ) - lw->xoffset--; -} - void list_window_first(list_window_t *lw) { diff --git a/src/list_window.h b/src/list_window.h index 79d2525..fe465be 100644 --- a/src/list_window.h +++ b/src/list_window.h @@ -58,9 +58,6 @@ void list_window_last(list_window_t *lw, int length); void list_window_previous_page(list_window_t *lw); void list_window_next_page(list_window_t *lw, int length); void list_window_check_selected(list_window_t *lw, int length); -/* not implemented yet */ -void list_window_right(list_window_t *lw, int length); -void list_window_left(list_window_t *lw); /* find a string in a list window */ int list_window_find(list_window_t *lw, diff --git a/src/main.c b/src/main.c index 2f01cab..f3cc155 100644 --- a/src/main.c +++ b/src/main.c @@ -136,13 +136,6 @@ catch_sigint( int sig ) exit(EXIT_SUCCESS); } -void -catch_sighup( int sig) -{ - printf("\n%s\n", _("Exiting...")); - exit(EXIT_SUCCESS); -} - void catch_sigcont( int sig ) { diff --git a/src/mpdclient.c b/src/mpdclient.c index 98743a3..b496a2d 100644 --- a/src/mpdclient.c +++ b/src/mpdclient.c @@ -719,17 +719,6 @@ mpdclient_playlist_update(mpdclient_t *c) #ifdef ENABLE_PLCHANGES -gint -mpdclient_compare_songs(gconstpointer a, gconstpointer b) -{ - mpd_Song *song1 = (mpd_Song *) a; - mpd_Song *song2 = (mpd_Song *) b; - - return song1->pos - song2->pos; -} - - - /* update playlist (plchanges) */ gint mpdclient_playlist_update_changes(mpdclient_t *c) diff --git a/src/options.c b/src/options.c index 0d3c2a6..ab383a3 100644 --- a/src/options.c +++ b/src/options.c @@ -235,12 +235,6 @@ handle_option(int c, char *arg) } } -options_t * -options_get(void) -{ - return &options; -} - options_t * options_parse(int argc, const char *argv[]) { diff --git a/src/screen.c b/src/screen.c index 93d305d..4949e28 100644 --- a/src/screen.c +++ b/src/screen.c @@ -322,7 +322,6 @@ paint_status_window(mpdclient_t *c) mpd_Song *song = c->song; int elapsedTime = 0; char *str = NULL; - char *timestr = NULL; int x = 0; if( time(NULL) - screen->status_timestamp <= SCREEN_STATUS_MESSAGE_TIME ) diff --git a/src/screen_artist.c b/src/screen_artist.c index 9f98fb6..b9acd3e 100644 --- a/src/screen_artist.c +++ b/src/screen_artist.c @@ -446,11 +446,11 @@ artist_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) case CMD_LIST_FIND_NEXT: case CMD_LIST_RFIND_NEXT: if( filelist ) - return screen_find(screen, c, + return screen_find(screen, lw, filelist->length, cmd, browse_lw_callback, (void *) filelist); else if ( metalist ) - return screen_find(screen, c, + return screen_find(screen, lw, metalist_length, cmd, artist_lw_callback, (void *) metalist); else diff --git a/src/screen_file.c b/src/screen_file.c index 75de5b3..31b3460 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -781,7 +781,7 @@ browse_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) case CMD_LIST_RFIND: case CMD_LIST_FIND_NEXT: case CMD_LIST_RFIND_NEXT: - return screen_find(screen, c, + return screen_find(screen, lw, filelist->length, cmd, browse_lw_callback, (void *) filelist); case CMD_MOUSE_EVENT: diff --git a/src/screen_help.c b/src/screen_help.c index 515e69b..4a79614 100644 --- a/src/screen_help.c +++ b/src/screen_help.c @@ -283,7 +283,7 @@ help_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) } lw->selected = lw->start+lw->rows; - if( screen_find(screen, c, + if( screen_find(screen, lw, help_text_rows, cmd, list_callback, NULL) ) { diff --git a/src/screen_keydef.c b/src/screen_keydef.c index 081b6ec..5014b29 100644 --- a/src/screen_keydef.c +++ b/src/screen_keydef.c @@ -367,7 +367,7 @@ keydef_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) case CMD_LIST_RFIND: case CMD_LIST_FIND_NEXT: case CMD_LIST_RFIND_NEXT: - return screen_find(screen, c, + return screen_find(screen, lw, length, cmd, list_callback, NULL); diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c index c5876f3..4cdc8f0 100644 --- a/src/screen_lyrics.c +++ b/src/screen_lyrics.c @@ -332,7 +332,7 @@ lyrics_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) } lw->selected = lw->start+lw->rows; - if( screen_find(screen, c, + if( screen_find(screen, lw, lyrics_text_rows, cmd, list_callback, NULL) ) { diff --git a/src/screen_play.c b/src/screen_play.c index 718bb13..c9bc84e 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -502,7 +502,7 @@ play_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) case CMD_LIST_RFIND: case CMD_LIST_FIND_NEXT: case CMD_LIST_RFIND_NEXT: - return screen_find(screen, c, + return screen_find(screen, lw, c->playlist.length, cmd, list_callback, (void *) c); case CMD_MOUSE_EVENT: diff --git a/src/screen_search.c b/src/screen_search.c index 76398e4..f163ef7 100644 --- a/src/screen_search.c +++ b/src/screen_search.c @@ -529,7 +529,7 @@ search_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) case CMD_LIST_FIND_NEXT: case CMD_LIST_RFIND_NEXT: if( filelist ) - return screen_find(screen, c, + return screen_find(screen, lw, filelist->length, cmd, browse_lw_callback, (void *) filelist); else diff --git a/src/screen_utils.c b/src/screen_utils.c index 43d57e1..40f73e6 100644 --- a/src/screen_utils.c +++ b/src/screen_utils.c @@ -102,13 +102,6 @@ screen_getstr(WINDOW *w, char *prompt) return screen_readln(w, prompt, NULL, NULL, NULL); } -char * -screen_getstr_masked(WINDOW *w, char *prompt) -{ - return screen_readln(w, prompt, NULL, NULL, NULL); -} - - char * screen_read_password(WINDOW *w, char *prompt) { @@ -154,7 +147,6 @@ screen_auth(mpdclient_t *c) /* query user for a string and find it in a list window */ int screen_find(screen_t *screen, - mpdclient_t *c, list_window_t *lw, int rows, command_t findcmd, diff --git a/src/screen_utils.h b/src/screen_utils.h index 27ff0eb..8040b10 100644 --- a/src/screen_utils.h +++ b/src/screen_utils.h @@ -15,7 +15,6 @@ char *screen_readln_masked(WINDOW *w, char *prompt); char *screen_read_pasword(WINDOW *w, char *prompt); /* query user for a string and find it in a list window */ int screen_find(screen_t *screen, - mpdclient_t *c, list_window_t *lw, int rows, command_t findcmd, diff --git a/src/src_lyrics.c b/src/src_lyrics.c index 395a24b..935fded 100644 --- a/src/src_lyrics.c +++ b/src/src_lyrics.c @@ -146,10 +146,7 @@ int src_lyr_init () int get_lyr_by_src (int priority, char *artist, char *title) { if(src_lyr_stack->len == 0) return -1; - //if (g_array_index (src_lyr_stack, src_lyr*, priority)->check_lyr() == 0) - //{ g_array_index (src_lyr_stack, src_lyr*, priority)->get_lyr (artist, title); - //} return 0; } @@ -163,7 +160,6 @@ int src_lyr_load_plugin_file (const char *file) src_lyr_plugin_register register_func; src_lyr *new_src = malloc (sizeof (src_lyr)); new_src->module = g_module_open (path->str, G_MODULE_BIND_LAZY); - //if (new_src->module == NULL) for (;;) fprintf (stderr, g_module_error()); if (!g_module_symbol (new_src->module, "register_me", (gpointer*) ®ister_func)) return -1; new_src->register_src_lyr = register_func; diff --git a/src/wreadln.c b/src/wreadln.c index fd65332..f4a7ec3 100644 --- a/src/wreadln.c +++ b/src/wreadln.c @@ -104,7 +104,6 @@ static inline void drawline(gint cursor, gint start, gint width, gint x0, - gint x1, gint y, gboolean masked, gchar *line, @@ -182,14 +181,14 @@ _wreadln(WINDOW *w, g_strlcpy(line, hlist->data, wrln_max_line_size); } cursor_move_to_eol(&cursor, &start, width, x0, x1, line); - drawline(cursor, start, width, x0, x1, y, masked, line, w); + drawline(cursor, start, width, x0, y, masked, line, w); } else if( initial_value ) { /* copy the initial value to the line buffer */ g_strlcpy(line, initial_value, wrln_max_line_size); cursor_move_to_eol(&cursor, &start, width, x0, x1, line); - drawline(cursor, start, width, x0, x1, y, masked, line, w); + drawline(cursor, start, width, x0, y, masked, line, w); } while( key!=13 && key!='\n' ) @@ -363,7 +362,7 @@ _wreadln(WINDOW *w, } } - drawline(cursor, start, width, x0, x1, y, masked, line, w); + drawline(cursor, start, width, x0, y, masked, line, w); } /* update history */ @@ -479,7 +478,6 @@ static inline void drawline(gint cursor, gint start, gint width, gint x0, - gint x1, gint y, gboolean masked, wchar_t *line, @@ -568,14 +566,14 @@ _wreadln(WINDOW *w, mbstowcs(wline, hlist->data, wrln_max_line_size); } cursor_move_to_eol(&cursor, &start, width, x0, x1, wline); - drawline(cursor, start, width, x0, x1, y, masked, wline, w); + drawline(cursor, start, width, x0, y, masked, wline, w); } else if( initial_value ) { /* copy the initial value to the line buffer */ mbstowcs(wline, initial_value, wrln_max_line_size); cursor_move_to_eol(&cursor, &start, width, x0, x1, wline); - drawline(cursor, start, width, x0, x1, y, masked, wline, w); + drawline(cursor, start, width, x0, y, masked, wline, w); } wch=0; @@ -749,7 +747,7 @@ _wreadln(WINDOW *w, } } } - drawline(cursor, start, width, x0, x1, y, masked, wline, w); + drawline(cursor, start, width, x0, y, masked, wline, w); } i = wcstombs(NULL,wline,0)+1; mbline = g_malloc0(i); -- 2.30.2