From a71d1dab6a6a8b4bb16363d3b59d126e6e7988f7 Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 4 May 2015 23:12:55 +0100 Subject: Use null check convention in windows.c --- src/ui/windows.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/ui') diff --git a/src/ui/windows.c b/src/ui/windows.c index 7a86403b..2334efc8 100644 --- a/src/ui/windows.c +++ b/src/ui/windows.c @@ -84,7 +84,7 @@ wins_get_chat(const char * const barejid) GList *values = g_hash_table_get_values(windows); GList *curr = values; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; if (window->type == WIN_CHAT) { ProfChatWin *chatwin = (ProfChatWin*)window; @@ -106,7 +106,7 @@ wins_get_muc_conf(const char * const roomjid) GList *values = g_hash_table_get_values(windows); GList *curr = values; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; if (window->type == WIN_MUC_CONFIG) { ProfMucConfWin *confwin = (ProfMucConfWin*)window; @@ -128,7 +128,7 @@ wins_get_muc(const char * const roomjid) GList *values = g_hash_table_get_values(windows); GList *curr = values; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; if (window->type == WIN_MUC) { ProfMucWin *mucwin = (ProfMucWin*)window; @@ -150,7 +150,7 @@ wins_get_private(const char * const fulljid) GList *values = g_hash_table_get_values(windows); GList *curr = values; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; if (window->type == WIN_PRIVATE) { ProfPrivateWin *privatewin = (ProfPrivateWin*)window; @@ -169,7 +169,7 @@ wins_get_private(const char * const fulljid) ProfWin * wins_get_current(void) { - if (windows != NULL) { + if (windows) { return g_hash_table_lookup(windows, GINT_TO_POINTER(current)); } else { return NULL; @@ -286,7 +286,7 @@ wins_get_next(void) GList *curr = keys; // find our place in the list - while (curr != NULL) { + while (curr) { if (current == GPOINTER_TO_INT(curr->data)) { break; } @@ -295,7 +295,7 @@ wins_get_next(void) // if there is a next window return it curr = g_list_next(curr); - if (curr != NULL) { + if (curr) { int next = GPOINTER_TO_INT(curr->data); g_list_free(keys); return wins_get_by_num(next); @@ -315,7 +315,7 @@ wins_get_previous(void) GList *curr = keys; // find our place in the list - while (curr != NULL) { + while (curr) { if (current == GPOINTER_TO_INT(curr->data)) { break; } @@ -324,7 +324,7 @@ wins_get_previous(void) // if there is a previous window return it curr = g_list_previous(curr); - if (curr != NULL) { + if (curr) { int previous = GPOINTER_TO_INT(curr->data); g_list_free(keys); return wins_get_by_num(previous); @@ -342,7 +342,7 @@ wins_get_num(ProfWin *window) GList *keys = g_hash_table_get_keys(windows); GList *curr = keys; - while (curr != NULL) { + while (curr) { gconstpointer num_p = curr->data; ProfWin *curr_win = g_hash_table_lookup(windows, num_p); if (curr_win == window) { @@ -468,7 +468,7 @@ wins_get_total_unread(void) GList *values = g_hash_table_get_values(windows); GList *curr = values; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; result += win_unread(window); curr = g_list_next(curr); @@ -484,7 +484,7 @@ wins_resize_all(void) GList *values = g_hash_table_get_values(windows); GList *curr = values; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; int subwin_cols = 0; @@ -564,7 +564,7 @@ wins_get_xmlconsole(void) GList *values = g_hash_table_get_values(windows); GList *curr = values; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; if (window->type == WIN_XML) { ProfXMLWin *xmlwin = (ProfXMLWin*)window; @@ -586,7 +586,7 @@ wins_get_chat_recipients(void) GList *values = g_hash_table_get_values(windows); GList *curr = values; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; if (window->type == WIN_CHAT) { ProfChatWin *chatwin = (ProfChatWin*)window; @@ -605,7 +605,7 @@ wins_get_prune_wins(void) GList *values = g_hash_table_get_values(windows); GList *curr = values; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; if (win_unread(window) == 0 && window->type != WIN_MUC && @@ -626,7 +626,7 @@ wins_lost_connection(void) GList *values = g_hash_table_get_values(windows); GList *curr = values; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; if (window->type != WIN_CONSOLE) { win_print(window, '-', NULL, 0, THEME_ERROR, "", "Lost connection."); @@ -719,7 +719,7 @@ wins_tidy(void) int num = 1; GList *curr = keys; - while (curr != NULL) { + while (curr) { ProfWin *window = g_hash_table_lookup(windows, curr->data); if (num == 10) { g_hash_table_insert(new_windows, GINT_TO_POINTER(0), window); @@ -761,7 +761,7 @@ wins_create_summary(void) keys = g_list_sort(keys, cmp_win_num); GList *curr = keys; - while (curr != NULL) { + while (curr) { ProfWin *window = g_hash_table_lookup(windows, curr->data); int ui_index = GPOINTER_TO_INT(curr->data); -- cgit 1.4.1-2-gfad0