diff options
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/cubeb_alsa.c | 1 | ||||
-rw-r--r-- | src/cubeb_utils.c | 38 | ||||
-rw-r--r-- | src/cubeb_utils.h | 13 | ||||
-rw-r--r-- | src/cubeb_winmm.c | 23 |
5 files changed, 21 insertions, 55 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a3e100a..31b0752 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,7 +56,6 @@ add_library(cubeb src/cubeb_panner.cpp src/cubeb_log.cpp src/cubeb_strings.c - src/cubeb_utils.c $<TARGET_OBJECTS:speex>) target_include_directories(cubeb PUBLIC include) target_include_directories(cubeb PRIVATE src) diff --git a/src/cubeb_alsa.c b/src/cubeb_alsa.c index aac565c..8cb37ee 100644 --- a/src/cubeb_alsa.c +++ b/src/cubeb_alsa.c @@ -17,7 +17,6 @@ #include <alsa/asoundlib.h> #include "cubeb/cubeb.h" #include "cubeb-internal.h" -#include "cubeb_utils.h" #define CUBEB_STREAM_MAX 16 #define CUBEB_WATCHDOG_MS 10000 diff --git a/src/cubeb_utils.c b/src/cubeb_utils.c deleted file mode 100644 index 6557f08..0000000 --- a/src/cubeb_utils.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright © 2016 Mozilla Foundation - * - * This program is made available under an ISC-style license. See the - * accompanying file LICENSE for details. - */ - -#include "cubeb_utils.h" -#include "cubeb_assert.h" - -#include <stdlib.h> - -static void -device_info_destroy(cubeb_device_info * info) -{ - XASSERT(info); - - free((void *) info->device_id); - free((void *) info->friendly_name); - free((void *) info->group_id); - free((void *) info->vendor_name); -} - -int -cubeb_utils_default_device_collection_destroy(cubeb * context, - cubeb_device_collection * collection) -{ - uint32_t i; - XASSERT(collection); - - (void) context; - - for (i = 0; i < collection->count; i++) - device_info_destroy(&collection->device[i]); - - free(collection->device); - return CUBEB_OK; -} diff --git a/src/cubeb_utils.h b/src/cubeb_utils.h index 00011ce..0966560 100644 --- a/src/cubeb_utils.h +++ b/src/cubeb_utils.h @@ -336,17 +336,4 @@ private: using auto_lock = std::lock_guard<owned_critical_section>; #endif // __cplusplus -// C language helpers - -#ifdef __cplusplus -extern "C" { -#endif - -int cubeb_utils_default_device_collection_destroy(cubeb * context, - cubeb_device_collection * collection); - -#ifdef __cplusplus -} -#endif - #endif /* CUBEB_UTILS */ diff --git a/src/cubeb_winmm.c b/src/cubeb_winmm.c index ae2284a..ce7371a 100644 --- a/src/cubeb_winmm.c +++ b/src/cubeb_winmm.c @@ -19,7 +19,6 @@ #include <math.h> #include "cubeb/cubeb.h" #include "cubeb-internal.h" -#include "cubeb_utils.h" /* This is missing from the MinGW headers. Use a safe fallback. */ #if !defined(MEMORY_ALLOCATION_ALIGNMENT) @@ -1017,6 +1016,26 @@ winmm_enumerate_devices(cubeb * context, cubeb_device_type type, return CUBEB_OK; } +static int +winmm_device_collection_destroy(cubeb * ctx, + cubeb_device_collection * collection) +{ + uint32_t i; + XASSERT(collection); + + (void) ctx; + + for (i = 0; i < collection->count; i++) { + free((void *) collection->device[i].device_id); + free((void *) collection->device[i].friendly_name); + free((void *) collection->device[i].group_id); + free((void *) collection->device[i].vendor_name); + } + + free(collection->device); + return CUBEB_OK; +} + static struct cubeb_ops const winmm_ops = { /*.init =*/ winmm_init, /*.get_backend_id =*/ winmm_get_backend_id, @@ -1025,7 +1044,7 @@ static struct cubeb_ops const winmm_ops = { /*.get_preferred_sample_rate =*/ winmm_get_preferred_sample_rate, /*.get_preferred_channel_layout =*/ NULL, /*.enumerate_devices =*/ winmm_enumerate_devices, - /*.device_collection_destroy =*/ cubeb_utils_default_device_collection_destroy, + /*.device_collection_destroy =*/ winmm_device_collection_destroy, /*.destroy =*/ winmm_destroy, /*.stream_init =*/ winmm_stream_init, /*.stream_destroy =*/ winmm_stream_destroy, |