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 @@ -41,32 +41,6 @@ struct t_hdata *buflist_hdata_buffer = NULL; 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. * @@ -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)