aboutsummaryrefslogtreecommitdiffstats
path: root/libgamepad_close_superdevice.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-07-23 14:39:44 +0200
committerMattias Andrée <maandree@kth.se>2022-07-23 14:40:11 +0200
commitd49393b339c47733c2eda207b8ba03d61db0a5a3 (patch)
treebc609622c3cabe1dc6b59970cb8a9a8364a561a7 /libgamepad_close_superdevice.c
downloadlibgamepad-d49393b339c47733c2eda207b8ba03d61db0a5a3.tar.gz
libgamepad-d49393b339c47733c2eda207b8ba03d61db0a5a3.tar.bz2
libgamepad-d49393b339c47733c2eda207b8ba03d61db0a5a3.tar.xz
First commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libgamepad_close_superdevice.c')
-rw-r--r--libgamepad_close_superdevice.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libgamepad_close_superdevice.c b/libgamepad_close_superdevice.c
new file mode 100644
index 0000000..dc212bd
--- /dev/null
+++ b/libgamepad_close_superdevice.c
@@ -0,0 +1,20 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+void
+libgamepad_close_superdevice(struct libgamepad_superdevice *device)
+{
+ if (device) {
+ free(device->syspath);
+ while (device->ndevices)
+ free(device->devices[--device->ndevices]);
+ free(device->devices);
+ while (device->nleds)
+ free(device->leds[--device->nleds]);
+ free(device->leds);
+ while (device->npower_supplies)
+ free(device->power_supplies[--device->npower_supplies]);
+ free(device->power_supplies);
+ }
+}