From: Max Kellermann Date: Mon, 15 Sep 2008 10:27:29 +0000 (+0200) Subject: fix function prototypes X-Git-Tag: v0.12_alpha1~319 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=76a8fab4adc293982f355609b89dde88d5f355e0;p=ncmpc.git fix function prototypes Add missing prototypes, and fix wrong prototypes. Convert lots of functions to "static" when they are only used within the current source file. --- diff --git a/src/command.c b/src/command.c index 4f4a8e9..733bf6a 100644 --- a/src/command.c +++ b/src/command.c @@ -30,6 +30,8 @@ #include "config.h" #include "ncmpc.h" #include "command.h" +#include "mpdclient.h" +#include "screen.h" #undef DEBUG_KEYS @@ -39,9 +41,6 @@ #define DK(x) #endif -extern void sigstop(void); -extern void screen_resize(void); - #define BS KEY_BACKSPACE #define DEL KEY_DC #define UP KEY_UP @@ -289,7 +288,7 @@ command_dump_keys(void) } } -int +static int set_key_flags(command_definition_t *cp, command_t command, int flags) { int i; diff --git a/src/main.c b/src/main.c index 022802c..6a6ba34 100644 --- a/src/main.c +++ b/src/main.c @@ -108,7 +108,7 @@ update_xterm_title(void) } } -void +static void exit_and_cleanup(void) { screen_exit(); @@ -128,14 +128,15 @@ exit_and_cleanup(void) g_timer_destroy(timer); } -void +static void catch_sigint( int sig ) { printf("\n%s\n", _("Exiting...")); exit(EXIT_SUCCESS); } -void + +static void catch_sigcont( int sig ) { D("catch_sigcont()\n"); diff --git a/src/mpdclient.h b/src/mpdclient.h index 5f231c3..c8cb868 100644 --- a/src/mpdclient.h +++ b/src/mpdclient.h @@ -69,6 +69,10 @@ typedef struct } mpdclient_t; /** functions ***************************************************************/ + +gint +mpdclient_finish_command(mpdclient_t *c); + mpdclient_t *mpdclient_new(void); mpdclient_t *mpdclient_free(mpdclient_t *c); gint mpdclient_connect(mpdclient_t *c, gchar *host, gint port, diff --git a/src/ncmpc.h b/src/ncmpc.h index 9caf860..0d87eba 100644 --- a/src/ncmpc.h +++ b/src/ncmpc.h @@ -82,4 +82,7 @@ void D(const char *format, ...); #define DEFAULT_SCROLL TRUE #define DEFAULT_SCROLL_SEP " *** " +void +sigstop(void); + #endif /* NCMPC_H */ diff --git a/src/screen.c b/src/screen.c index af3417a..4624974 100644 --- a/src/screen.c +++ b/src/screen.c @@ -126,7 +126,7 @@ lookup_mode(gint id) return -1; } -gint get_cur_mode_id() +gint get_cur_mode_id(void) { return screens[screen->mode].id; } @@ -525,7 +525,7 @@ screen_status_printf(const char *format, ...) } void -ncurses_init() +ncurses_init(void) { /* initialize the curses library */ @@ -623,6 +623,7 @@ ncurses_init() } } +int screen_init(mpdclient_t *c) { gint i; diff --git a/src/screen.h b/src/screen.h index 4f3057d..0ecd9ef 100644 --- a/src/screen.h +++ b/src/screen.h @@ -65,6 +65,8 @@ typedef struct { screen_get_lw_fn_t get_lw; } screen_functions_t; +void +ncurses_init(void); int screen_init(mpdclient_t *c); int screen_exit(void); @@ -79,9 +81,30 @@ void screen_cmd(mpdclient_t *c, command_t cmd); gint screen_get_id(const char *name); -gint get_cur_mode_id(); +gint get_cur_mode_id(void); int screen_get_mouse_event(mpdclient_t *c, list_window_t *lw, int lw_length, unsigned long *bstate, int *row); +screen_functions_t * +get_screen_search(void); + +screen_functions_t * +get_screen_browse(void); + +screen_functions_t * +get_screen_playlist(void); + +screen_functions_t * +get_screen_help(void); + +screen_functions_t * +get_screen_lyrics(void); + +screen_functions_t * +get_screen_keydef(void); + +screen_functions_t * +get_screen_clock(void); + #endif diff --git a/src/screen_file.c b/src/screen_file.c index 35245a1..0dbaab4 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -740,8 +740,8 @@ browse_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) return list_window_cmd(lw, filelist->length, cmd); } -list_window_t * -get_filelist_window() +static list_window_t * +get_filelist_window(void) { return lw; } diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c index 4417d13..793eae7 100644 --- a/src/screen_lyrics.c +++ b/src/screen_lyrics.c @@ -46,7 +46,7 @@ int src_selection; static void lyrics_paint(screen_t *screen, mpdclient_t *c); -FILE *create_lyr_file(char *artist, char *title) +static FILE *create_lyr_file(char *artist, char *title) { char path[1024]; @@ -65,7 +65,7 @@ FILE *create_lyr_file(char *artist, char *title) } -int store_lyr_hd() +static int store_lyr_hd(void) { char artist[512]; char title[512]; @@ -96,13 +96,13 @@ int store_lyr_hd() } -void check_repaint() +static void check_repaint(void) { if(screen_get_id("lyrics") == get_cur_mode_id())lyrics_paint(NULL, NULL); } -gpointer get_lyr(void *c) +static gpointer get_lyr(void *c) { mpd_Status *status = ((retrieval_spec*)c)->client->status; mpd_Song *cur = ((retrieval_spec*)c)->client->song; diff --git a/src/screen_play.c b/src/screen_play.c index 1878bd9..6cd28d6 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -37,6 +37,7 @@ #include "colors.h" #include "screen.h" #include "screen_utils.h" +#include "screen_play.h" #define MAX_SONG_LENGTH 512 @@ -120,7 +121,8 @@ center_playing_item(screen_t *screen, mpdclient_t *c) return 0; } -void save_pre_completion_cb(GCompletion *gcmp, gchar *line, void *data) +static void +save_pre_completion_cb(GCompletion *gcmp, gchar *line, void *data) { completion_callback_data_t *tmp = (completion_callback_data_t *)data; GList **list = tmp->list; @@ -133,8 +135,9 @@ void save_pre_completion_cb(GCompletion *gcmp, gchar *line, void *data) } } -void save_post_completion_cb(GCompletion *gcmp, gchar *line, GList *items, - void *data) +static void +save_post_completion_cb(GCompletion *gcmp, gchar *line, GList *items, + void *data) { completion_callback_data_t *tmp = (completion_callback_data_t *)data; screen_t *screen = tmp->screen; @@ -227,8 +230,8 @@ playlist_save(screen_t *screen, mpdclient_t *c, char *name, char *defaultname) return 0; } -void add_dir(GCompletion *gcmp, gchar *dir, GList **dir_list, GList **list, - mpdclient_t *c) +static void add_dir(GCompletion *gcmp, gchar *dir, GList **dir_list, + GList **list, mpdclient_t *c) { g_completion_remove_items(gcmp, *list); *list = string_list_remove(*list, dir); @@ -237,7 +240,7 @@ void add_dir(GCompletion *gcmp, gchar *dir, GList **dir_list, GList **list, *dir_list = g_list_append(*dir_list, g_strdup(dir)); } -void add_pre_completion_cb(GCompletion *gcmp, gchar *line, void *data) +static void add_pre_completion_cb(GCompletion *gcmp, gchar *line, void *data) { completion_callback_data_t *tmp = (completion_callback_data_t *)data; GList **dir_list = tmp->dir_list; @@ -259,8 +262,8 @@ void add_pre_completion_cb(GCompletion *gcmp, gchar *line, void *data) } } -void add_post_completion_cb(GCompletion *gcmp, gchar *line, GList *items, - void *data) +static void add_post_completion_cb(GCompletion *gcmp, gchar *line, + GList *items, void *data) { completion_callback_data_t *tmp = (completion_callback_data_t *)data; GList **dir_list = tmp->dir_list; diff --git a/src/screen_search.c b/src/screen_search.c index 8169686..a74ef60 100644 --- a/src/screen_search.c +++ b/src/screen_search.c @@ -188,7 +188,7 @@ search_clear(screen_t *screen, mpdclient_t *c, gboolean clear_pattern) } #ifdef FUTURE -mpdclient_filelist_t * +static mpdclient_filelist_t * filelist_search(mpdclient_t *c, int exact_match, int table, gchar *pattern) { mpdclient_filelist_t *list, *list2; @@ -454,7 +454,7 @@ get_title(char *str, size_t size) } static list_window_t * -get_filelist_window() +get_filelist_window(void) { return lw; } diff --git a/src/screen_utils.c b/src/screen_utils.c index 9b3bfa2..a1cdedb 100644 --- a/src/screen_utils.c +++ b/src/screen_utils.c @@ -102,7 +102,7 @@ screen_getstr(WINDOW *w, const char *prompt) return screen_readln(w, prompt, NULL, NULL, NULL); } -char * +static char * screen_read_password(WINDOW *w, const char *prompt) { if(w == NULL) @@ -124,7 +124,7 @@ screen_read_password(WINDOW *w, const char *prompt) curs_set(0); } -gint +static gint _screen_auth(mpdclient_t *c, gint recursion) { mpd_clearError(c->connection); diff --git a/src/src_lyrics.c b/src/src_lyrics.c index ecacef2..4d41aea 100644 --- a/src/src_lyrics.c +++ b/src/src_lyrics.c @@ -103,7 +103,9 @@ int deregister_lyr_hd (); int register_lyr_hd (src_lyr *source_descriptor); #endif -int src_lyr_stack_init () +static int src_lyr_plugins_load(void); + +void src_lyr_stack_init(void) { src_lyr_stack = g_array_new (TRUE, FALSE, sizeof (src_lyr*)); @@ -124,7 +126,7 @@ int src_lyr_stack_init () #endif } -int src_lyr_init () +int src_lyr_init(void) { src_lyr_stack_init (); @@ -145,7 +147,7 @@ int get_lyr_by_src (int priority, char *artist, char *title) return 0; } -int src_lyr_load_plugin_file (const char *file) +static int src_lyr_load_plugin_file(const char *file) { GString *path; path = g_string_new (PLUGIN_DIR_SYSTEM); @@ -162,7 +164,7 @@ int src_lyr_load_plugin_file (const char *file) return 0; } -void src_lyr_plugins_load_from_dir (GDir *plugin_dir) +static void src_lyr_plugins_load_from_dir(GDir *plugin_dir) { const gchar *cur_file; @@ -173,7 +175,7 @@ void src_lyr_plugins_load_from_dir (GDir *plugin_dir) } } -int src_lyr_plugins_load () +static int src_lyr_plugins_load(void) { GDir *plugin_dir; diff --git a/src/src_lyrics.h b/src/src_lyrics.h index 140906e..7a2e7ea 100644 --- a/src/src_lyrics.h +++ b/src/src_lyrics.h @@ -55,11 +55,11 @@ struct src_lyr char *description; int (*register_src_lyr) (src_lyr *source_descriptor); - int (*deregister_src_lyr) (); + int (*deregister_src_lyr)(void); int (*check_lyr) (char *artist, char *title, char *url); int (*get_lyr) (char *artist, char *title); - int (*state_lyr) (); + int (*state_lyr)(void); #ifndef DISABLE_PLUGIN_SYSTEM GModule *module; @@ -70,8 +70,10 @@ typedef int (*src_lyr_plugin_register) (src_lyr *source_descriptor); GArray *src_lyr_stack; -int src_lyr_stack_init (); -int src_lyr_init (); +int get_text_line(formed_text *text, int num, char *dest, int len); + +void src_lyr_stack_init(void); +int src_lyr_init(void); int get_lyr_by_src (int priority, char *artist, char *title); #endif diff --git a/src/wreadln.c b/src/wreadln.c index e49308a..f6b848c 100644 --- a/src/wreadln.c +++ b/src/wreadln.c @@ -123,7 +123,7 @@ static inline void drawline(gint cursor, /* libcurses version */ -gchar * +static gchar * _wreadln(WINDOW *w, const gchar *prompt, const gchar *initial_value, @@ -475,7 +475,7 @@ static inline void drawline(gint cursor, /* libcursesw version */ -gchar * +static gchar * _wreadln(WINDOW *w, const gchar *prompt, const gchar *initial_value, diff --git a/src/wreadln.h b/src/wreadln.h index 35e91bc..d448f41 100644 --- a/src/wreadln.h +++ b/src/wreadln.h @@ -34,5 +34,12 @@ gchar *wreadln(WINDOW *w, /* the curses window to use */ GCompletion *gcmp /* a GCompletion structure or NULL */ ); +gchar * +wreadln_masked(WINDOW *w, + const gchar *prompt, + const gchar *initial_value, + gint x1, + GList **history, + GCompletion *gcmp); #endif