mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2026-01-03 12:40:15 +01:00
Fix queue_num_free_elements
Return 0 for an unallocated queue, and return the actual number of events (rather than one too little). Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
7889b467f7
commit
e1d599f4c9
1 changed files with 4 additions and 1 deletions
|
|
@ -208,7 +208,10 @@ queue_size(struct libevdev *dev)
|
|||
static inline size_t
|
||||
queue_num_free_elements(struct libevdev *dev)
|
||||
{
|
||||
return dev->queue_size - dev->queue_next - 1;
|
||||
if (dev->queue_size == 0)
|
||||
return 0;
|
||||
|
||||
return dev->queue_size - dev->queue_next;
|
||||
}
|
||||
|
||||
static inline struct input_event *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue