aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-07-26 11:45:20 -0700
committerChris Robinson <[email protected]>2016-07-26 12:02:03 -0700
commit5e11a738c6b18a367070450ec46dfb714fe433d7 (patch)
treebb298e6d200b486067c34c7496f6c638169f2a8e /Alc/backends
parentd2eb866abeb699394a35610b4764c8e42acc71b5 (diff)
Combine VECTOR_RESIZE and VECTOR_RESERVE
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/alsa.c2
-rw-r--r--Alc/backends/dsound.c2
-rw-r--r--Alc/backends/mmdevapi.c8
-rw-r--r--Alc/backends/pulseaudio.c2
-rw-r--r--Alc/backends/qsa.c7
-rw-r--r--Alc/backends/winmm.c6
6 files changed, 11 insertions, 16 deletions
diff --git a/Alc/backends/alsa.c b/Alc/backends/alsa.c
index 280f5019..7a9045bb 100644
--- a/Alc/backends/alsa.c
+++ b/Alc/backends/alsa.c
@@ -242,7 +242,7 @@ static void clear_devlist(vector_DevMap *devlist)
AL_STRING_DEINIT((i)->device_name); \
} while(0)
VECTOR_FOR_EACH(DevMap, *devlist, FREE_DEV);
- VECTOR_RESIZE(*devlist, 0);
+ VECTOR_RESIZE(*devlist, 0, 0);
#undef FREE_DEV
}
diff --git a/Alc/backends/dsound.c b/Alc/backends/dsound.c
index 1ff99352..da6fbacf 100644
--- a/Alc/backends/dsound.c
+++ b/Alc/backends/dsound.c
@@ -123,7 +123,7 @@ static void clear_devlist(vector_DevMap *list)
{
#define DEINIT_STR(i) AL_STRING_DEINIT((i)->name)
VECTOR_FOR_EACH(DevMap, *list, DEINIT_STR);
- VECTOR_RESIZE(*list, 0);
+ VECTOR_RESIZE(*list, 0, 0);
#undef DEINIT_STR
}
diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c
index f102e385..60d3be00 100644
--- a/Alc/backends/mmdevapi.c
+++ b/Alc/backends/mmdevapi.c
@@ -79,7 +79,7 @@ static void clear_devlist(vector_DevMap *list)
(i)->devid = NULL; \
} while(0)
VECTOR_FOR_EACH(DevMap, *list, CLEAR_DEVMAP);
- VECTOR_RESIZE(*list, 0);
+ VECTOR_RESIZE(*list, 0, 0);
#undef CLEAR_DEVMAP
}
@@ -258,11 +258,7 @@ static HRESULT probe_devices(IMMDeviceEnumerator *devenum, EDataFlow flowdir, ve
if(SUCCEEDED(hr) && count > 0)
{
clear_devlist(list);
- if(!VECTOR_RESERVE(*list, count))
- {
- IMMDeviceCollection_Release(coll);
- return E_OUTOFMEMORY;
- }
+ VECTOR_RESIZE(*list, 0, count);
hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(devenum, flowdir,
eMultimedia, &defdev);
diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c
index d317b576..220c1b7d 100644
--- a/Alc/backends/pulseaudio.c
+++ b/Alc/backends/pulseaudio.c
@@ -443,7 +443,7 @@ static void clear_devlist(vector_DevMap *list)
#define DEINIT_STRS(i) (AL_STRING_DEINIT((i)->name),AL_STRING_DEINIT((i)->device_name))
VECTOR_FOR_EACH(DevMap, *list, DEINIT_STRS);
#undef DEINIT_STRS
- VECTOR_RESIZE(*list, 0);
+ VECTOR_RESIZE(*list, 0, 0);
}
diff --git a/Alc/backends/qsa.c b/Alc/backends/qsa.c
index a1fbce63..b7923517 100644
--- a/Alc/backends/qsa.c
+++ b/Alc/backends/qsa.c
@@ -117,8 +117,7 @@ static void deviceList(int type, vector_DevMap *devmap)
if(max_cards < 0)
return;
- VECTOR_RESERVE(*devmap, max_cards+1);
- VECTOR_RESIZE(*devmap, 0);
+ VECTOR_RESIZE(*devmap, 0, max_cards+1);
entry.name = strdup(qsaDevice);
entry.card = 0;
@@ -893,8 +892,8 @@ void alc_qsa_probe(enum DevProbe type)
case ALL_DEVICE_PROBE:
#define FREE_NAME(iter) free((iter)->name)
VECTOR_FOR_EACH(DevMap, DeviceNameMap, FREE_NAME);
+ VECTOR_RESIZE(DeviceNameMap, 0, 0);
#undef FREE_NAME
- VECTOR_RESIZE(DeviceNameMap, 0);
deviceList(SND_PCM_CHANNEL_PLAYBACK, &DeviceNameMap);
#define APPEND_DEVICE(iter) AppendAllDevicesList((iter)->name)
@@ -905,8 +904,8 @@ void alc_qsa_probe(enum DevProbe type)
case CAPTURE_DEVICE_PROBE:
#define FREE_NAME(iter) free((iter)->name)
VECTOR_FOR_EACH(DevMap, CaptureNameMap, FREE_NAME);
+ VECTOR_RESIZE(CaptureNameMap, 0, 0);
#undef FREE_NAME
- VECTOR_RESIZE(CaptureNameMap, 0);
deviceList(SND_PCM_CHANNEL_CAPTURE, &CaptureNameMap);
#define APPEND_DEVICE(iter) AppendCaptureDeviceList((iter)->name)
diff --git a/Alc/backends/winmm.c b/Alc/backends/winmm.c
index 180f764b..6e990a35 100644
--- a/Alc/backends/winmm.c
+++ b/Alc/backends/winmm.c
@@ -46,7 +46,7 @@ static vector_al_string CaptureDevices;
static void clear_devlist(vector_al_string *list)
{
VECTOR_FOR_EACH(al_string, *list, al_string_deinit);
- VECTOR_RESIZE(*list, 0);
+ VECTOR_RESIZE(*list, 0, 0);
}
@@ -58,7 +58,7 @@ static void ProbePlaybackDevices(void)
clear_devlist(&PlaybackDevices);
numdevs = waveOutGetNumDevs();
- VECTOR_RESERVE(PlaybackDevices, numdevs);
+ VECTOR_RESIZE(PlaybackDevices, 0, numdevs);
for(i = 0;i < numdevs;i++)
{
WAVEOUTCAPSW WaveCaps;
@@ -101,7 +101,7 @@ static void ProbeCaptureDevices(void)
clear_devlist(&CaptureDevices);
numdevs = waveInGetNumDevs();
- VECTOR_RESERVE(CaptureDevices, numdevs);
+ VECTOR_RESIZE(CaptureDevices, 0, numdevs);
for(i = 0;i < numdevs;i++)
{
WAVEINCAPSW WaveCaps;