Cleaned up usage of linked lists and added missing functionality.
- Added a list_remove_first() which is generally better than list_remove() provided you want to remove the first element. - Added a list_append_list() to append and move all nodes from one list to another.
This commit is contained in:
@@ -50,9 +50,7 @@ static void history_add(struct plugin_handle* plugin, struct plugin_user* from,
|
||||
list_append(data->chat_history, log);
|
||||
while (list_size(data->chat_history) > data->history_max)
|
||||
{
|
||||
char* msg = list_get_first(data->chat_history);
|
||||
list_remove(data->chat_history, msg);
|
||||
hub_free(msg);
|
||||
list_remove_first(data->chat_history, hub_free);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user