mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-01-10 23:07:04 +00:00
[client] ll: fix failure to properly track the list size
This commit is contained in:
parent
25d370ef22
commit
18e84c88a0
@ -44,6 +44,7 @@ struct ll * ll_new()
|
|||||||
list->head = NULL;
|
list->head = NULL;
|
||||||
list->tail = NULL;
|
list->tail = NULL;
|
||||||
list->pos = NULL;
|
list->pos = NULL;
|
||||||
|
list->count = 0;
|
||||||
LG_LOCK_INIT(list->lock);
|
LG_LOCK_INIT(list->lock);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@ -64,6 +65,8 @@ void ll_push(struct ll * list, void * data)
|
|||||||
item->next = NULL;
|
item->next = NULL;
|
||||||
|
|
||||||
LG_LOCK(list->lock);
|
LG_LOCK(list->lock);
|
||||||
|
++list->count;
|
||||||
|
|
||||||
if (!list->head)
|
if (!list->head)
|
||||||
{
|
{
|
||||||
list->head = item;
|
list->head = item;
|
||||||
@ -72,7 +75,6 @@ void ll_push(struct ll * list, void * data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
++list->count;
|
|
||||||
list->tail->next = item;
|
list->tail->next = item;
|
||||||
list->tail = item;
|
list->tail = item;
|
||||||
LG_UNLOCK(list->lock);
|
LG_UNLOCK(list->lock);
|
||||||
|
Loading…
Reference in New Issue
Block a user