# HG changeset patch # User Mikael Berthe # Date 1121718428 -3600 # Node ID eb994ee400292453502b9b2229b0b587a7996bb9 # Parent 3ec329a1c621fed1906e7a4621f7a8cbd36ebc63 Make some functions static diff -r 3ec329a1c621 -r eb994ee40029 mcabber/src/commands.c --- a/mcabber/src/commands.c Mon Jul 18 20:10:36 2005 +0100 +++ b/mcabber/src/commands.c Mon Jul 18 21:27:08 2005 +0100 @@ -33,23 +33,23 @@ #include "settings.h" // Commands callbacks -void do_roster(char *arg); -void do_status(char *arg); -void do_add(char *arg); -void do_del(char *arg); -void do_group(char *arg); -void do_say(char *arg); -void do_msay(char *arg); -void do_buffer(char *arg); -void do_clear(char *arg); -void do_info(char *arg); -void do_rename(char *arg); -void do_move(char *arg); -void do_set(char *arg); -void do_alias(char *arg); -void do_bind(char *arg); -void do_connect(char *arg); -void do_disconnect(char *arg); +static void do_roster(char *arg); +static void do_status(char *arg); +static void do_add(char *arg); +static void do_del(char *arg); +static void do_group(char *arg); +static void do_say(char *arg); +static void do_msay(char *arg); +static void do_buffer(char *arg); +static void do_clear(char *arg); +static void do_info(char *arg); +static void do_rename(char *arg); +static void do_move(char *arg); +static void do_set(char *arg); +static void do_alias(char *arg); +static void do_bind(char *arg); +static void do_connect(char *arg); +static void do_disconnect(char *arg); // Global variable for the commands list static GSList *Commands; @@ -323,7 +323,7 @@ /* Commands callback functions */ -void do_roster(char *arg) +static void do_roster(char *arg) { if (!strcasecmp(arg, "top")) { scr_RosterTop(); @@ -368,7 +368,7 @@ scr_LogPrint("Unrecognized parameter!"); } -void do_status(char *arg) +static void do_status(char *arg) { enum imstatus st; int len; @@ -407,7 +407,7 @@ jb_setstatus(st, msg); } -void do_add(char *arg) +static void do_add(char *arg) { char *id, *nick; if (!arg || (*arg == 0)) { @@ -430,7 +430,7 @@ g_free(id); } -void do_del(char *arg) +static void do_del(char *arg) { const char *jid; @@ -447,7 +447,7 @@ jb_delbuddy(jid); } -void do_group(char *arg) +static void do_group(char *arg) { gpointer group; guint leave_windowbuddy; @@ -487,7 +487,7 @@ if (leave_windowbuddy) scr_ShowBuddyWindow(); } -void do_say(char *arg) +static void do_say(char *arg) { gpointer bud; @@ -508,7 +508,7 @@ send_message(arg); } -void do_msay(char *arg) +static void do_msay(char *arg) { /* Parameters: begin verbatim abort send */ gpointer bud; @@ -560,7 +560,7 @@ scr_set_multimode(FALSE); } -void do_buffer(char *arg) +static void do_buffer(char *arg) { if (!strcasecmp(arg, "top")) { scr_BufferTop(); @@ -572,12 +572,12 @@ scr_LogPrint("Unrecognized parameter!"); } -void do_clear(char *arg) // Alias for "/buffer clear" +static void do_clear(char *arg) // Alias for "/buffer clear" { do_buffer("clear"); } -void do_info(char *arg) +static void do_info(char *arg) { gpointer bud; const char *jid, *name, *st_msg; @@ -624,7 +624,7 @@ g_free(buffer); } -void do_rename(char *arg) +static void do_rename(char *arg) { gpointer bud; const char *jid, *group; @@ -660,7 +660,7 @@ update_roster = TRUE; } -void do_move(char *arg) +static void do_move(char *arg) { gpointer bud; const char *jid, *name; @@ -694,7 +694,7 @@ update_roster = TRUE; } -void do_set(char *arg) +static void do_set(char *arg) { guint assign; const gchar *option, *value; @@ -724,7 +724,7 @@ } } -void do_alias(char *arg) +static void do_alias(char *arg) { guint assign; const gchar *alias, *value; @@ -763,7 +763,7 @@ } } -void do_bind(char *arg) +static void do_bind(char *arg) { guint assign; const gchar *keycode, *value; @@ -789,12 +789,12 @@ settings_set(SETTINGS_TYPE_BINDING, keycode, value); } -void do_connect(char *arg) +static void do_connect(char *arg) { mcabber_connect(); } -void do_disconnect(char *arg) +static void do_disconnect(char *arg) { jb_disconnect(); } diff -r 3ec329a1c621 -r eb994ee40029 mcabber/src/main.c --- a/mcabber/src/main.c Mon Jul 18 20:10:36 2005 +0100 +++ b/mcabber/src/main.c Mon Jul 18 21:27:08 2005 +0100 @@ -131,7 +131,7 @@ } } -void ask_password(void) +static void ask_password(void) { char *password, *p; size_t passsize = 128; @@ -165,7 +165,7 @@ return; } -void credits(void) +static void credits(void) { printf(MCABBER_VERSION "\n"); printf(EMAIL "\n"); diff -r 3ec329a1c621 -r eb994ee40029 mcabber/src/roster.c --- a/mcabber/src/roster.c Mon Jul 18 20:10:36 2005 +0100 +++ b/mcabber/src/roster.c Mon Jul 18 21:27:08 2005 +0100 @@ -52,14 +52,14 @@ /* ### Roster functions ### */ // Comparison function used to search in the roster (compares jids and types) -gint roster_compare_jid_type(roster *a, roster *b) { +static gint roster_compare_jid_type(roster *a, roster *b) { if (! (a->type & b->type)) return -1; // arbitrary (but should be != , of course) return strcasecmp(a->jid, b->jid); } // Comparison function used to sort the roster (by name) -gint roster_compare_name(roster *a, roster *b) { +static gint roster_compare_name(roster *a, roster *b) { return strcasecmp(a->name, b->name); } diff -r 3ec329a1c621 -r eb994ee40029 mcabber/src/screen.c --- a/mcabber/src/screen.c Mon Jul 18 20:10:36 2005 +0100 +++ b/mcabber/src/screen.c Mon Jul 18 21:27:08 2005 +0100 @@ -42,7 +42,7 @@ #define window_entry(n) list_entry(n, window_entry_t, list) -inline void check_offset(int); +static inline void check_offset(int); LIST_HEAD(window_list); @@ -83,27 +83,15 @@ /* Functions */ -int scr_WindowWidth(WINDOW * win) +static int scr_WindowWidth(WINDOW * win) { int x, y; getmaxyx(win, y, x); return x; } -void scr_clear_box(WINDOW *win, int y, int x, int height, int width, int Color) -{ - int i, j; - - wattrset(win, COLOR_PAIR(Color)); - for (i = 0; i < height; i++) { - wmove(win, y + i, x); - for (j = 0; j < width; j++) - wprintw(win, " "); - } -} - -void scr_draw_box(WINDOW * win, int y, int x, int height, int width, - int Color, chtype box, chtype border) +static void scr_draw_box(WINDOW * win, int y, int x, int height, int width, + int Color, chtype box, chtype border) { int i, j; @@ -132,7 +120,7 @@ } } -int FindColor(const char *name) +static int FindColor(const char *name) { if (!strcmp(name, "default")) return -1; @@ -156,7 +144,7 @@ return -1; } -void ParseColors(void) +static void ParseColors(void) { const char *colors[8] = { "", "", @@ -209,8 +197,7 @@ } } - -window_entry_t *scr_CreateBuddyPanel(const char *title, int dont_show) +static window_entry_t *scr_CreateBuddyPanel(const char *title, int dont_show) { int x; int y; @@ -256,7 +243,7 @@ return tmp; } -window_entry_t *scr_SearchWindow(const char *winId) +static window_entry_t *scr_SearchWindow(const char *winId) { struct list_head *pos, *n; window_entry_t *search_entry = NULL; @@ -274,7 +261,7 @@ // scr_UpdateWindow() // (Re-)Display the given chat window. -void scr_UpdateWindow(window_entry_t *win_entry) +static void scr_UpdateWindow(window_entry_t *win_entry) { int n; int width; @@ -357,7 +344,7 @@ // scr_ShowWindow() // Display the chat window with the given identifier. -void scr_ShowWindow(const char *winId) +static void scr_ShowWindow(const char *winId) { window_entry_t *win_entry = scr_SearchWindow(winId); @@ -795,21 +782,6 @@ return ch; } -WINDOW *scr_GetRosterWindow(void) -{ - return rosterWnd; -} - -WINDOW *scr_GetStatusWindow(void) -{ - return chatWnd; -} - -WINDOW *scr_GetInputWindow(void) -{ - return inputWnd; -} - // set_current_buddy(newbuddy) // Set the current_buddy to newbuddy (if not NULL) // Lock the newbuddy, and unlock the previous current_buddy @@ -1042,6 +1014,7 @@ doupdate(); } +// TODO Merge BufferTop & BufferBottom // scr_BufferTop() // Jump to the head of the current buddy window void scr_BufferTop(void) @@ -1222,7 +1195,7 @@ // scr_cmdhisto_prev() // Look for previous line beginning w/ the given mask in the inputLine history // Returns NULL if none found -const char *scr_cmdhisto_prev(char *mask, guint len) +static const char *scr_cmdhisto_prev(char *mask, guint len) { GList *hl; if (!cmdhisto_cur) { @@ -1247,7 +1220,7 @@ // scr_cmdhisto_next() // Look for next line beginning w/ the given mask in the inputLine history // Returns NULL if none found -const char *scr_cmdhisto_next(char *mask, guint len) +static const char *scr_cmdhisto_next(char *mask, guint len) { GList *hl; if (!cmdhisto_cur) return NULL; @@ -1324,7 +1297,7 @@ // 0 -> command // 1 -> parameter 1 (etc.) // If > 0, then *p_row is set to the beginning of the row -int which_row(char **p_row) +static int which_row(char **p_row) { int row = -1; char *p; @@ -1357,7 +1330,7 @@ // Insert the given text at the current cursor position. // The cursor is moved. We don't check if the cursor still is in the screen // after, the caller should do that. -void scr_insert_text(const char *text) +static void scr_insert_text(const char *text) { char tmpLine[INPUTLINE_LENGTH+1]; int len = strlen(text); @@ -1375,7 +1348,7 @@ // scr_handle_tab() // Function called when tab is pressed. // Initiate or continue a completion... -void scr_handle_tab(void) +static void scr_handle_tab(void) { int nrow; char *row; @@ -1439,7 +1412,7 @@ } } -void scr_cancel_current_completion(void) +static void scr_cancel_current_completion(void) { char *c; guint back = cancel_completion(); @@ -1450,7 +1423,7 @@ *c = *(c+back); } -void scr_end_current_completion(void) +static void scr_end_current_completion(void) { done_completion(); completion_started = FALSE; @@ -1459,7 +1432,7 @@ // check_offset(int direction) // Check inputline_offset value, and make sure the cursor is inside the // screen. -inline void check_offset(int direction) +static inline void check_offset(int direction) { // Left side if (inputline_offset && direction <= 0) { @@ -1478,7 +1451,7 @@ } } -inline void refresh_inputline(void) +static inline void refresh_inputline(void) { mvwprintw(inputWnd, 0,0, "%s", inputLine + inputline_offset); wclrtoeol(inputWnd); diff -r 3ec329a1c621 -r eb994ee40029 mcabber/src/screen.h --- a/mcabber/src/screen.h Mon Jul 18 20:10:36 2005 +0100 +++ b/mcabber/src/screen.h Mon Jul 18 21:27:08 2005 +0100 @@ -39,8 +39,6 @@ inline const char *scr_get_multiline(); void scr_handle_sigint(void); -WINDOW *scr_GetInputWindow(void); - int scr_Getch(void); int process_key(int); diff -r 3ec329a1c621 -r eb994ee40029 mcabber/src/settings.c --- a/mcabber/src/settings.c Mon Jul 18 20:10:36 2005 +0100 +++ b/mcabber/src/settings.c Mon Jul 18 21:27:08 2005 +0100 @@ -35,7 +35,7 @@ gchar *value; } T_setting; -inline GSList **get_list_ptr(guint type) +static inline GSList **get_list_ptr(guint type) { if (type == SETTINGS_TYPE_OPTION) return &option; else if (type == SETTINGS_TYPE_ALIAS) return &alias; @@ -44,7 +44,7 @@ } // Return a pointer to the node with the requested key, or NULL if none found -GSList *settings_find(GSList *list, const gchar *key) +static GSList *settings_find(GSList *list, const gchar *key) { GSList *ptr;