aboutsummaryrefslogtreecommitdiffstats
path: root/libgamepad_close_device.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-07-26 16:10:41 +0200
committerMattias Andrée <maandree@kth.se>2022-07-26 16:14:00 +0200
commit08184b90b04961086e7b00650651188a9652a0c5 (patch)
tree204dd698fd9efb83955ad58506018591cc56ca59 /libgamepad_close_device.c
parentDo not relay on libevdev for button/axis names, an prepare for device specific names, and add reverse lookup functions (diff)
downloadlibgamepad-08184b90b04961086e7b00650651188a9652a0c5.tar.gz
libgamepad-08184b90b04961086e7b00650651188a9652a0c5.tar.bz2
libgamepad-08184b90b04961086e7b00650651188a9652a0c5.tar.xz
Hide implementation details
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--libgamepad_close_device.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/libgamepad_close_device.c b/libgamepad_close_device.c
index edb8361..3b00149 100644
--- a/libgamepad_close_device.c
+++ b/libgamepad_close_device.c
@@ -6,15 +6,17 @@ void
libgamepad_close_device(struct libgamepad_device *device)
{
if (device) {
- if (device->close_fd)
- close(device->fd);
- if (device->dev)
- libevdev_free(device->dev);
+ if (device->internals) {
+ if (device->internals->close_fd)
+ close(device->fd);
+ if (device->internals->dev)
+ libevdev_free(device->internals->dev);
+ free(device->internals);
+ device->internals = NULL;
+ }
free(device->buttons);
free(device->absolute_axes);
free(device->relative_axes);
- device->close_fd = 0;
- device->dev = NULL;
device->buttons = NULL;
device->absolute_axes = NULL;
device->relative_axes = NULL;