1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2026-03-02 04:09:18 +00:00

improves slist implementation (#29)

This commit is contained in:
Falk Werner
2019-04-26 20:50:57 +02:00
committed by GitHub
parent fa78e23533
commit 9130f00289
6 changed files with 153 additions and 64 deletions

View File

@@ -65,7 +65,7 @@ struct wf_impl_session * wf_impl_session_create(
static void wf_impl_session_dispose_filesystems(
struct wf_slist * filesystems)
{
struct wf_slist_item * item = filesystems->first;
struct wf_slist_item * item = wf_slist_first(filesystems);
while (NULL != item)
{
struct wf_slist_item * next = item->next;
@@ -156,11 +156,11 @@ static struct wf_impl_filesystem * wf_impl_session_get_filesystem(
{
struct wf_impl_filesystem * result = NULL;
struct wf_slist_item * item = session->filesystems.first;
struct wf_slist_item * item = wf_slist_first(&session->filesystems);
while (NULL != item)
{
struct wf_slist_item * next = item->next;
struct wf_impl_filesystem * filesystem = wf_container_of(session->filesystems.first, struct wf_impl_filesystem, item);
struct wf_impl_filesystem * filesystem = wf_container_of(item, struct wf_impl_filesystem, item);
if (wsi == filesystem->wsi)
{
result = filesystem;

View File

@@ -12,7 +12,7 @@ void wf_impl_session_manager_init(
void wf_impl_session_manager_cleanup(
struct wf_impl_session_manager * manager)
{
struct wf_slist_item * item = manager->sessions.first;
struct wf_slist_item * item = wf_slist_first(&manager->sessions);
while (NULL != item)
{
struct wf_slist_item * next = item->next;
@@ -47,7 +47,7 @@ struct wf_impl_session * wf_impl_session_manager_get(
{
struct wf_impl_session * session = NULL;
struct wf_slist_item * item = manager->sessions.first;
struct wf_slist_item * item = wf_slist_first(&manager->sessions);
while (NULL != item)
{
struct wf_slist_item * next = item->next;
@@ -68,11 +68,10 @@ void wf_impl_session_manager_remove(
struct wf_impl_session_manager * manager,
struct lws * wsi)
{
struct wf_slist_item * item = manager->sessions.first;
struct wf_slist_item * prev = NULL;
while (NULL != item)
struct wf_slist_item * prev = &manager->sessions.head;
while (NULL != prev->next)
{
struct wf_slist_item * next = item->next;
struct wf_slist_item * item = prev->next;
struct wf_impl_session * session = wf_container_of(item, struct wf_impl_session, item);
if (wsi == session->wsi)
{
@@ -81,7 +80,6 @@ void wf_impl_session_manager_remove(
break;
}
prev = item;
item = next;
prev = prev->next;
}
}