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:
Jan Vidar Krey
2013-03-22 20:00:40 +01:00
parent b81bb2cbd9
commit 2d6f69d299
8 changed files with 170 additions and 24 deletions

View File

@@ -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);
}
}