diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2017-03-12 20:52:30 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2017-03-25 14:19:48 +0100 |
commit | db0ecc07fe138adf9f44705f6f4167ebd003e2e0 (patch) | |
tree | efb1941f4ec564ca07ca0dbde9570bc5b404c736 /src | |
parent | a8bf5eb7bab3941fb71d0b6f9bb847d695e9a218 (diff) | |
download | weechat-db0ecc07fe138adf9f44705f6f4167ebd003e2e0.zip |
buflist: use hotlist pointer in buffer hdata
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/buflist/buflist-bar-item.c | 3 | ||||
-rw-r--r-- | src/plugins/buflist/buflist.c | 41 |
2 files changed, 7 insertions, 37 deletions
diff --git a/src/plugins/buflist/buflist-bar-item.c b/src/plugins/buflist/buflist-bar-item.c index 16f0f3775..9a4ab5045 100644 --- a/src/plugins/buflist/buflist-bar-item.c +++ b/src/plugins/buflist/buflist-bar-item.c @@ -97,7 +97,8 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data, current_buffer = (ptr_buffer == ptr_current_buffer); - ptr_hotlist = buflist_search_hotlist_for_buffer (ptr_buffer); + ptr_hotlist = weechat_hdata_pointer (buflist_hdata_buffer, + ptr_buffer, "hotlist"); ptr_name = weechat_hdata_string (buflist_hdata_buffer, ptr_buffer, "short_name"); diff --git a/src/plugins/buflist/buflist.c b/src/plugins/buflist/buflist.c index ab5501310..daf83a1fd 100644 --- a/src/plugins/buflist/buflist.c +++ b/src/plugins/buflist/buflist.c @@ -42,32 +42,6 @@ struct t_hdata *buflist_hdata_hotlist = NULL; /* - * Searches the hotlist pointer for the buffer. - * - * Returns pointer to hotlit, NULL if buffer is not in hotlist. - */ - -struct t_gui_hotlist * -buflist_search_hotlist_for_buffer (struct t_gui_buffer *buffer) -{ - struct t_gui_hotlist *ptr_hotlist; - struct t_gui_buffer *ptr_buffer; - - ptr_hotlist = weechat_hdata_get_list (buflist_hdata_hotlist, - "gui_hotlist"); - while (ptr_hotlist) - { - ptr_buffer = weechat_hdata_pointer (buflist_hdata_hotlist, - ptr_hotlist, "buffer"); - if (ptr_buffer == buffer) - break; - ptr_hotlist = weechat_hdata_move (buflist_hdata_hotlist, - ptr_hotlist, 1); - } - return ptr_hotlist; -} - -/* * Compares a hdata variable of two objects. * * Returns: @@ -164,7 +138,7 @@ int buflist_compare_buffers (void *data, struct t_arraylist *arraylist, void *pointer1, void *pointer2) { - int i, reverse, rc, hotlist_scanned; + int i, reverse, rc; const char *ptr_field; struct t_gui_hotlist *ptr_hotlist1, *ptr_hotlist2; @@ -172,10 +146,6 @@ buflist_compare_buffers (void *data, struct t_arraylist *arraylist, (void) data; (void) arraylist; - hotlist_scanned = 0; - ptr_hotlist1 = NULL; - ptr_hotlist2 = NULL; - for (i = 0; i < buflist_config_sort_fields_count; i++) { reverse = 1; @@ -191,11 +161,10 @@ buflist_compare_buffers (void *data, struct t_arraylist *arraylist, rc = 0; if (strncmp (ptr_field, "hotlist.", 8) == 0) { - if (!hotlist_scanned) - { - ptr_hotlist1 = buflist_search_hotlist_for_buffer (pointer1); - ptr_hotlist2 = buflist_search_hotlist_for_buffer (pointer2); - } + ptr_hotlist1 = weechat_hdata_pointer (buflist_hdata_buffer, + pointer1, "hotlist"); + ptr_hotlist2 = weechat_hdata_pointer (buflist_hdata_buffer, + pointer2, "hotlist"); if (!ptr_hotlist1 && !ptr_hotlist2) rc = 0; else if (ptr_hotlist1 && !ptr_hotlist2) |