summaryrefslogtreecommitdiffstats
path: root/src/device.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/device.c')
-rw-r--r--src/device.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/device.c b/src/device.c
index 29be9d1..0844499 100644
--- a/src/device.c
+++ b/src/device.c
@@ -746,10 +746,15 @@ int device_get_count(int include_hidden)
return count;
}
-int device_get_list(int include_hidden, struct device_info *p)
+int device_get_list(int include_hidden, struct device_info **devices)
{
int count = 0;
pthread_mutex_lock(&device_list_mutex);
+
+ int total_count = collection_count(&device_list);
+ *devices = malloc(sizeof(struct device_info) * total_count);
+ struct device_info *p = *devices;
+
FOREACH(struct mux_device *dev, &device_list) {
if((dev->state == MUXDEV_ACTIVE) && (include_hidden || dev->visible)) {
p->id = dev->id;