Shorten VECTOR_ITER_ macros to VECTOR_
This commit is contained in:
parent
d5e624391b
commit
f4ff5fc106
@ -237,16 +237,13 @@ static vector_DevMap CaptureDevices;
|
||||
|
||||
static void clear_devlist(vector_DevMap *devlist)
|
||||
{
|
||||
DevMap *iter, *end;
|
||||
|
||||
iter = VECTOR_ITER_BEGIN(*devlist);
|
||||
end = VECTOR_ITER_END(*devlist);
|
||||
for(;iter != end;iter++)
|
||||
{
|
||||
AL_STRING_DEINIT(iter->name);
|
||||
AL_STRING_DEINIT(iter->device_name);
|
||||
}
|
||||
#define FREE_DEV(i) do { \
|
||||
AL_STRING_DEINIT((i)->name); \
|
||||
AL_STRING_DEINIT((i)->device_name); \
|
||||
} while(0)
|
||||
VECTOR_FOR_EACH(DevMap, *devlist, FREE_DEV);
|
||||
VECTOR_RESIZE(*devlist, 0);
|
||||
#undef FREE_DEV
|
||||
}
|
||||
|
||||
|
||||
@ -635,7 +632,7 @@ static ALCenum ALCplaybackAlsa_open(ALCplaybackAlsa *self, const ALCchar *name)
|
||||
#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, name) == 0)
|
||||
VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_NAME);
|
||||
#undef MATCH_NAME
|
||||
if(iter == VECTOR_ITER_END(PlaybackDevices))
|
||||
if(iter == VECTOR_END(PlaybackDevices))
|
||||
return ALC_INVALID_VALUE;
|
||||
driver = al_string_get_cstr(iter->device_name);
|
||||
}
|
||||
@ -969,7 +966,7 @@ static ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name)
|
||||
#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, name) == 0)
|
||||
VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_NAME);
|
||||
#undef MATCH_NAME
|
||||
if(iter == VECTOR_ITER_END(CaptureDevices))
|
||||
if(iter == VECTOR_END(CaptureDevices))
|
||||
return ALC_INVALID_VALUE;
|
||||
driver = al_string_get_cstr(iter->device_name);
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ static BOOL CALLBACK DSoundEnumDevices(GUID *guid, const WCHAR *desc, const WCHA
|
||||
|
||||
#define MATCH_ENTRY(i) (al_string_cmp(entry.name, (i)->name) == 0)
|
||||
VECTOR_FIND_IF(iter, const DevMap, *devices, MATCH_ENTRY);
|
||||
if(iter == VECTOR_ITER_END(*devices)) break;
|
||||
if(iter == VECTOR_END(*devices)) break;
|
||||
#undef MATCH_ENTRY
|
||||
count++;
|
||||
}
|
||||
@ -351,7 +351,7 @@ static ALCenum ALCdsoundPlayback_open(ALCdsoundPlayback *self, const ALCchar *de
|
||||
#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, deviceName) == 0)
|
||||
VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_NAME);
|
||||
#undef MATCH_NAME
|
||||
if(iter == VECTOR_ITER_END(PlaybackDevices))
|
||||
if(iter == VECTOR_END(PlaybackDevices))
|
||||
return ALC_INVALID_VALUE;
|
||||
guid = &iter->guid;
|
||||
}
|
||||
@ -712,7 +712,7 @@ static ALCenum ALCdsoundCapture_open(ALCdsoundCapture *self, const ALCchar *devi
|
||||
#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, deviceName) == 0)
|
||||
VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_NAME);
|
||||
#undef MATCH_NAME
|
||||
if(iter == VECTOR_ITER_END(CaptureDevices))
|
||||
if(iter == VECTOR_END(CaptureDevices))
|
||||
return ALC_INVALID_VALUE;
|
||||
guid = &iter->guid;
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ static void add_device(IMMDevice *device, LPCWSTR devid, vector_DevMap *list)
|
||||
|
||||
#define MATCH_ENTRY(i) (al_string_cmp(entry.name, (i)->name) == 0)
|
||||
VECTOR_FIND_IF(iter, const DevMap, *list, MATCH_ENTRY);
|
||||
if(iter == VECTOR_ITER_END(*list)) break;
|
||||
if(iter == VECTOR_END(*list)) break;
|
||||
#undef MATCH_ENTRY
|
||||
count++;
|
||||
}
|
||||
@ -696,7 +696,7 @@ static ALCenum ALCmmdevPlayback_open(ALCmmdevPlayback *self, const ALCchar *devi
|
||||
hr = E_FAIL;
|
||||
#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, deviceName) == 0)
|
||||
VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_NAME);
|
||||
if(iter == VECTOR_ITER_END(PlaybackDevices))
|
||||
if(iter == VECTOR_END(PlaybackDevices))
|
||||
WARN("Failed to find device name matching \"%s\"\n", deviceName);
|
||||
else
|
||||
{
|
||||
@ -1332,7 +1332,7 @@ static ALCenum ALCmmdevCapture_open(ALCmmdevCapture *self, const ALCchar *device
|
||||
hr = E_FAIL;
|
||||
#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, deviceName) == 0)
|
||||
VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_NAME);
|
||||
if(iter == VECTOR_ITER_END(CaptureDevices))
|
||||
if(iter == VECTOR_END(CaptureDevices))
|
||||
WARN("Failed to find device name matching \"%s\"\n", deviceName);
|
||||
else
|
||||
{
|
||||
|
@ -527,7 +527,7 @@ static void ALCpulsePlayback_deviceCallback(pa_context *UNUSED(context), const p
|
||||
|
||||
#define MATCH_INFO_NAME(iter) (al_string_cmp_cstr((iter)->device_name, info->name) == 0)
|
||||
VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_INFO_NAME);
|
||||
if(iter != VECTOR_ITER_END(PlaybackDevices)) return;
|
||||
if(iter != VECTOR_END(PlaybackDevices)) return;
|
||||
#undef MATCH_INFO_NAME
|
||||
|
||||
AL_STRING_INIT(entry.name);
|
||||
@ -548,7 +548,7 @@ static void ALCpulsePlayback_deviceCallback(pa_context *UNUSED(context), const p
|
||||
|
||||
#define MATCH_ENTRY(i) (al_string_cmp(entry.name, (i)->name) == 0)
|
||||
VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_ENTRY);
|
||||
if(iter == VECTOR_ITER_END(PlaybackDevices)) break;
|
||||
if(iter == VECTOR_END(PlaybackDevices)) break;
|
||||
#undef MATCH_ENTRY
|
||||
count++;
|
||||
}
|
||||
@ -861,7 +861,7 @@ static ALCenum ALCpulsePlayback_open(ALCpulsePlayback *self, const ALCchar *name
|
||||
#define MATCH_NAME(iter) (al_string_cmp_cstr((iter)->name, name) == 0)
|
||||
VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_NAME);
|
||||
#undef MATCH_NAME
|
||||
if(iter == VECTOR_ITER_END(PlaybackDevices))
|
||||
if(iter == VECTOR_END(PlaybackDevices))
|
||||
return ALC_INVALID_VALUE;
|
||||
pulse_name = al_string_get_cstr(iter->device_name);
|
||||
dev_name = iter->name;
|
||||
@ -1247,7 +1247,7 @@ static void ALCpulseCapture_deviceCallback(pa_context *UNUSED(context), const pa
|
||||
|
||||
#define MATCH_INFO_NAME(iter) (al_string_cmp_cstr((iter)->device_name, info->name) == 0)
|
||||
VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_INFO_NAME);
|
||||
if(iter != VECTOR_ITER_END(CaptureDevices)) return;
|
||||
if(iter != VECTOR_END(CaptureDevices)) return;
|
||||
#undef MATCH_INFO_NAME
|
||||
|
||||
AL_STRING_INIT(entry.name);
|
||||
@ -1268,7 +1268,7 @@ static void ALCpulseCapture_deviceCallback(pa_context *UNUSED(context), const pa
|
||||
|
||||
#define MATCH_ENTRY(i) (al_string_cmp(entry.name, (i)->name) == 0)
|
||||
VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_ENTRY);
|
||||
if(iter == VECTOR_ITER_END(CaptureDevices)) break;
|
||||
if(iter == VECTOR_END(CaptureDevices)) break;
|
||||
#undef MATCH_ENTRY
|
||||
count++;
|
||||
}
|
||||
@ -1439,7 +1439,7 @@ static ALCenum ALCpulseCapture_open(ALCpulseCapture *self, const ALCchar *name)
|
||||
#define MATCH_NAME(iter) (al_string_cmp_cstr((iter)->name, name) == 0)
|
||||
VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_NAME);
|
||||
#undef MATCH_NAME
|
||||
if(iter == VECTOR_ITER_END(CaptureDevices))
|
||||
if(iter == VECTOR_END(CaptureDevices))
|
||||
return ALC_INVALID_VALUE;
|
||||
pulse_name = al_string_get_cstr(iter->device_name);
|
||||
al_string_copy(&device->DeviceName, iter->name);
|
||||
|
@ -277,7 +277,7 @@ static ALCenum qsa_open_playback(ALCdevice* device, const ALCchar* deviceName)
|
||||
#define MATCH_DEVNAME(iter) ((iter)->name && strcmp(deviceName, (iter)->name)==0)
|
||||
VECTOR_FIND_IF(iter, const DevMap, DeviceNameMap, MATCH_DEVNAME);
|
||||
#undef MATCH_DEVNAME
|
||||
if(iter == VECTOR_ITER_END(DeviceNameMap))
|
||||
if(iter == VECTOR_END(DeviceNameMap))
|
||||
{
|
||||
free(data);
|
||||
return ALC_INVALID_DEVICE;
|
||||
@ -624,7 +624,7 @@ static ALCenum qsa_open_capture(ALCdevice* device, const ALCchar* deviceName)
|
||||
#define MATCH_DEVNAME(iter) ((iter)->name && strcmp(deviceName, (iter)->name)==0)
|
||||
VECTOR_FIND_IF(iter, const DevMap, CaptureNameMap, MATCH_DEVNAME);
|
||||
#undef MATCH_DEVNAME
|
||||
if(iter == VECTOR_ITER_END(CaptureNameMap))
|
||||
if(iter == VECTOR_END(CaptureNameMap))
|
||||
{
|
||||
free(data);
|
||||
return ALC_INVALID_DEVICE;
|
||||
|
@ -83,7 +83,7 @@ static void ProbePlaybackDevices(void)
|
||||
|
||||
#define MATCH_ENTRY(i) (al_string_cmp(dname, *(i)) == 0)
|
||||
VECTOR_FIND_IF(iter, const al_string, PlaybackDevices, MATCH_ENTRY);
|
||||
if(iter == VECTOR_ITER_END(PlaybackDevices)) break;
|
||||
if(iter == VECTOR_END(PlaybackDevices)) break;
|
||||
#undef MATCH_ENTRY
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ static void ProbeCaptureDevices(void)
|
||||
|
||||
#define MATCH_ENTRY(i) (al_string_cmp(dname, *(i)) == 0)
|
||||
VECTOR_FIND_IF(iter, const al_string, CaptureDevices, MATCH_ENTRY);
|
||||
if(iter == VECTOR_ITER_END(CaptureDevices)) break;
|
||||
if(iter == VECTOR_END(CaptureDevices)) break;
|
||||
#undef MATCH_ENTRY
|
||||
}
|
||||
|
||||
@ -258,11 +258,11 @@ static ALCenum ALCwinmmPlayback_open(ALCwinmmPlayback *self, const ALCchar *devi
|
||||
#define MATCH_DEVNAME(iter) (!al_string_empty(*(iter)) && \
|
||||
(!deviceName || al_string_cmp_cstr(*(iter), deviceName) == 0))
|
||||
VECTOR_FIND_IF(iter, const al_string, PlaybackDevices, MATCH_DEVNAME);
|
||||
if(iter == VECTOR_ITER_END(PlaybackDevices))
|
||||
if(iter == VECTOR_END(PlaybackDevices))
|
||||
return ALC_INVALID_VALUE;
|
||||
#undef MATCH_DEVNAME
|
||||
|
||||
DeviceID = (UINT)(iter - VECTOR_ITER_BEGIN(PlaybackDevices));
|
||||
DeviceID = (UINT)(iter - VECTOR_BEGIN(PlaybackDevices));
|
||||
|
||||
retry_open:
|
||||
memset(&self->Format, 0, sizeof(WAVEFORMATEX));
|
||||
@ -544,11 +544,11 @@ static ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *name)
|
||||
// Find the Device ID matching the deviceName if valid
|
||||
#define MATCH_DEVNAME(iter) (!al_string_empty(*(iter)) && (!name || al_string_cmp_cstr(*iter, name) == 0))
|
||||
VECTOR_FIND_IF(iter, const al_string, CaptureDevices, MATCH_DEVNAME);
|
||||
if(iter == VECTOR_ITER_END(CaptureDevices))
|
||||
if(iter == VECTOR_END(CaptureDevices))
|
||||
return ALC_INVALID_VALUE;
|
||||
#undef MATCH_DEVNAME
|
||||
|
||||
DeviceID = (UINT)(iter - VECTOR_ITER_BEGIN(CaptureDevices));
|
||||
DeviceID = (UINT)(iter - VECTOR_BEGIN(CaptureDevices));
|
||||
|
||||
switch(device->FmtChans)
|
||||
{
|
||||
|
@ -456,7 +456,7 @@ static void DirectorySearch(const char *path, const char *ext, vector_al_string
|
||||
FindClose(hdl);
|
||||
|
||||
if(VECTOR_SIZE(*results) > base)
|
||||
qsort(VECTOR_ITER_BEGIN(*results)+base, VECTOR_SIZE(*results)-base,
|
||||
qsort(VECTOR_BEGIN(*results)+base, VECTOR_SIZE(*results)-base,
|
||||
sizeof(VECTOR_FRONT(*results)), StringSortCompare);
|
||||
}
|
||||
|
||||
@ -501,7 +501,7 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir)
|
||||
if(is_slash(VECTOR_BACK(path)))
|
||||
{
|
||||
VECTOR_POP_BACK(path);
|
||||
*VECTOR_ITER_END(path) = 0;
|
||||
*VECTOR_END(path) = 0;
|
||||
}
|
||||
}
|
||||
else if(!(cwdbuf=_wgetcwd(NULL, 0)))
|
||||
@ -512,7 +512,7 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir)
|
||||
if(is_slash(VECTOR_BACK(path)))
|
||||
{
|
||||
VECTOR_POP_BACK(path);
|
||||
*VECTOR_ITER_END(path) = 0;
|
||||
*VECTOR_END(path) = 0;
|
||||
}
|
||||
free(cwdbuf);
|
||||
}
|
||||
@ -629,8 +629,8 @@ static void DirectorySearch(const char *path, const char *ext, vector_al_string
|
||||
closedir(dir);
|
||||
|
||||
if(VECTOR_SIZE(*results) > base)
|
||||
qsort(VECTOR_ITER_BEGIN(*results)+base, VECTOR_SIZE(*results)-base,
|
||||
sizeof(VECTOR_FRONT(*results)), StringSortCompare);
|
||||
qsort(VECTOR_BEGIN(*results)+base, VECTOR_SIZE(*results)-base,
|
||||
sizeof(VECTOR_FRONT(*results)), StringSortCompare);
|
||||
}
|
||||
}
|
||||
|
||||
@ -673,7 +673,7 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir)
|
||||
if(VECTOR_BACK(path) == '/')
|
||||
{
|
||||
VECTOR_POP_BACK(path);
|
||||
*VECTOR_ITER_END(path) = 0;
|
||||
*VECTOR_END(path) = 0;
|
||||
}
|
||||
al_string_append_cstr(&path, "/.local/share/");
|
||||
al_string_append_cstr(&path, subdir);
|
||||
@ -826,7 +826,7 @@ void al_string_clear(al_string *str)
|
||||
*/
|
||||
VECTOR_RESERVE(*str, 1);
|
||||
VECTOR_RESIZE(*str, 0);
|
||||
*VECTOR_ITER_END(*str) = 0;
|
||||
*VECTOR_END(*str) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -858,8 +858,8 @@ void al_string_copy(al_string *str, const_al_string from)
|
||||
size_t len = al_string_length(from);
|
||||
VECTOR_RESERVE(*str, len+1);
|
||||
VECTOR_RESIZE(*str, 0);
|
||||
VECTOR_INSERT(*str, VECTOR_ITER_END(*str), VECTOR_ITER_BEGIN(from), VECTOR_ITER_BEGIN(from)+len);
|
||||
*VECTOR_ITER_END(*str) = 0;
|
||||
VECTOR_INSERT(*str, VECTOR_END(*str), VECTOR_BEGIN(from), VECTOR_BEGIN(from)+len);
|
||||
*VECTOR_END(*str) = 0;
|
||||
}
|
||||
|
||||
void al_string_copy_cstr(al_string *str, const al_string_char_type *from)
|
||||
@ -867,8 +867,8 @@ void al_string_copy_cstr(al_string *str, const al_string_char_type *from)
|
||||
size_t len = strlen(from);
|
||||
VECTOR_RESERVE(*str, len+1);
|
||||
VECTOR_RESIZE(*str, 0);
|
||||
VECTOR_INSERT(*str, VECTOR_ITER_END(*str), from, from+len);
|
||||
*VECTOR_ITER_END(*str) = 0;
|
||||
VECTOR_INSERT(*str, VECTOR_END(*str), from, from+len);
|
||||
*VECTOR_END(*str) = 0;
|
||||
}
|
||||
|
||||
void al_string_copy_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to)
|
||||
@ -876,15 +876,15 @@ void al_string_copy_range(al_string *str, const al_string_char_type *from, const
|
||||
size_t len = to - from;
|
||||
VECTOR_RESERVE(*str, len+1);
|
||||
VECTOR_RESIZE(*str, 0);
|
||||
VECTOR_INSERT(*str, VECTOR_ITER_END(*str), from, to);
|
||||
*VECTOR_ITER_END(*str) = 0;
|
||||
VECTOR_INSERT(*str, VECTOR_END(*str), from, to);
|
||||
*VECTOR_END(*str) = 0;
|
||||
}
|
||||
|
||||
void al_string_append_char(al_string *str, const al_string_char_type c)
|
||||
{
|
||||
VECTOR_RESERVE(*str, al_string_length(*str)+2);
|
||||
VECTOR_PUSH_BACK(*str, c);
|
||||
*VECTOR_ITER_END(*str) = 0;
|
||||
*VECTOR_END(*str) = 0;
|
||||
}
|
||||
|
||||
void al_string_append_cstr(al_string *str, const al_string_char_type *from)
|
||||
@ -893,8 +893,8 @@ void al_string_append_cstr(al_string *str, const al_string_char_type *from)
|
||||
if(len != 0)
|
||||
{
|
||||
VECTOR_RESERVE(*str, al_string_length(*str)+len+1);
|
||||
VECTOR_INSERT(*str, VECTOR_ITER_END(*str), from, from+len);
|
||||
*VECTOR_ITER_END(*str) = 0;
|
||||
VECTOR_INSERT(*str, VECTOR_END(*str), from, from+len);
|
||||
*VECTOR_END(*str) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -903,8 +903,8 @@ void al_string_append_range(al_string *str, const al_string_char_type *from, con
|
||||
if(to != from)
|
||||
{
|
||||
VECTOR_RESERVE(*str, al_string_length(*str)+(to-from)+1);
|
||||
VECTOR_INSERT(*str, VECTOR_ITER_END(*str), from, to);
|
||||
*VECTOR_ITER_END(*str) = 0;
|
||||
VECTOR_INSERT(*str, VECTOR_END(*str), from, to);
|
||||
*VECTOR_END(*str) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -917,7 +917,7 @@ void al_string_copy_wcstr(al_string *str, const wchar_t *from)
|
||||
VECTOR_RESERVE(*str, len);
|
||||
VECTOR_RESIZE(*str, len-1);
|
||||
WideCharToMultiByte(CP_UTF8, 0, from, -1, &VECTOR_FRONT(*str), len, NULL, NULL);
|
||||
*VECTOR_ITER_END(*str) = 0;
|
||||
*VECTOR_END(*str) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -930,7 +930,7 @@ void al_string_append_wcstr(al_string *str, const wchar_t *from)
|
||||
VECTOR_RESERVE(*str, strlen+len);
|
||||
VECTOR_RESIZE(*str, strlen+len-1);
|
||||
WideCharToMultiByte(CP_UTF8, 0, from, -1, &VECTOR_FRONT(*str) + strlen, len, NULL, NULL);
|
||||
*VECTOR_ITER_END(*str) = 0;
|
||||
*VECTOR_END(*str) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -943,7 +943,7 @@ void al_string_append_wrange(al_string *str, const wchar_t *from, const wchar_t
|
||||
VECTOR_RESERVE(*str, strlen+len+1);
|
||||
VECTOR_RESIZE(*str, strlen+len);
|
||||
WideCharToMultiByte(CP_UTF8, 0, from, (int)(to-from), &VECTOR_FRONT(*str) + strlen, len+1, NULL, NULL);
|
||||
*VECTOR_ITER_END(*str) = 0;
|
||||
*VECTOR_END(*str) = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -595,7 +595,7 @@ static void AddFileEntry(vector_HrtfEntry *list, al_string *filename)
|
||||
#define MATCH_NAME(i) (al_string_cmp(entry.name, (i)->name) == 0)
|
||||
VECTOR_FIND_IF(iter, const HrtfEntry, *list, MATCH_NAME);
|
||||
#undef MATCH_NAME
|
||||
} while(iter != VECTOR_ITER_END(*list));
|
||||
} while(iter != VECTOR_END(*list));
|
||||
|
||||
TRACE("Adding entry \"%s\" from file \"%s\"\n", al_string_get_cstr(entry.name),
|
||||
al_string_get_cstr(*filename));
|
||||
@ -667,11 +667,11 @@ vector_HrtfEntry EnumerateHrtf(const_al_string devname)
|
||||
/* Find the preferred HRTF and move it to the front of the list. */
|
||||
#define FIND_ENTRY(i) (al_string_cmp_cstr((i)->name, defaulthrtf) == 0)
|
||||
VECTOR_FIND_IF(iter, const HrtfEntry, list, FIND_ENTRY);
|
||||
if(iter != VECTOR_ITER_END(list) && iter != VECTOR_ITER_BEGIN(list))
|
||||
if(iter != VECTOR_END(list) && iter != VECTOR_BEGIN(list))
|
||||
{
|
||||
HrtfEntry entry = *iter;
|
||||
memmove(&VECTOR_ELEM(list,1), &VECTOR_ELEM(list,0),
|
||||
(iter-VECTOR_ITER_BEGIN(list))*sizeof(HrtfEntry));
|
||||
(iter-VECTOR_BEGIN(list))*sizeof(HrtfEntry));
|
||||
VECTOR_ELEM(list,0) = entry;
|
||||
}
|
||||
else
|
||||
|
20
Alc/vector.h
20
Alc/vector.h
@ -39,8 +39,8 @@ ALboolean vector_resize(char *ptr, size_t base_size, size_t obj_size, size_t obj
|
||||
#define VECTOR_CAPACITY(_x) ((_x) ? (_x)->Capacity : 0)
|
||||
#define VECTOR_SIZE(_x) ((_x) ? (_x)->Size : 0)
|
||||
|
||||
#define VECTOR_ITER_BEGIN(_x) ((_x) ? (_x)->Data + 0 : NULL)
|
||||
#define VECTOR_ITER_END(_x) ((_x) ? (_x)->Data + (_x)->Size : NULL)
|
||||
#define VECTOR_BEGIN(_x) ((_x) ? (_x)->Data + 0 : NULL)
|
||||
#define VECTOR_END(_x) ((_x) ? (_x)->Data + (_x)->Size : NULL)
|
||||
|
||||
ALboolean vector_insert(char *ptr, size_t base_size, size_t obj_size, void *ins_pos, const void *datstart, const void *datend);
|
||||
#ifdef __GNUC__
|
||||
@ -67,22 +67,22 @@ ALboolean vector_insert(char *ptr, size_t base_size, size_t obj_size, void *ins_
|
||||
#define VECTOR_ELEM(_x, _o) ((_x)->Data[(_o)])
|
||||
|
||||
#define VECTOR_FOR_EACH(_t, _x, _f) do { \
|
||||
_t *_iter = VECTOR_ITER_BEGIN((_x)); \
|
||||
_t *_end = VECTOR_ITER_END((_x)); \
|
||||
_t *_iter = VECTOR_BEGIN((_x)); \
|
||||
_t *_end = VECTOR_END((_x)); \
|
||||
for(;_iter != _end;++_iter) \
|
||||
_f(_iter); \
|
||||
} while(0)
|
||||
|
||||
#define VECTOR_FOR_EACH_PARAMS(_t, _x, _f, ...) do { \
|
||||
_t *_iter = VECTOR_ITER_BEGIN((_x)); \
|
||||
_t *_end = VECTOR_ITER_END((_x)); \
|
||||
_t *_iter = VECTOR_BEGIN((_x)); \
|
||||
_t *_end = VECTOR_END((_x)); \
|
||||
for(;_iter != _end;++_iter) \
|
||||
_f(__VA_ARGS__, _iter); \
|
||||
} while(0)
|
||||
|
||||
#define VECTOR_FIND_IF(_i, _t, _x, _f) do { \
|
||||
_t *_iter = VECTOR_ITER_BEGIN((_x)); \
|
||||
_t *_end = VECTOR_ITER_END((_x)); \
|
||||
_t *_iter = VECTOR_BEGIN((_x)); \
|
||||
_t *_end = VECTOR_END((_x)); \
|
||||
for(;_iter != _end;++_iter) \
|
||||
{ \
|
||||
if(_f(_iter)) \
|
||||
@ -92,8 +92,8 @@ ALboolean vector_insert(char *ptr, size_t base_size, size_t obj_size, void *ins_
|
||||
} while(0)
|
||||
|
||||
#define VECTOR_FIND_IF_PARMS(_i, _t, _x, _f, ...) do { \
|
||||
_t *_iter = VECTOR_ITER_BEGIN((_x)); \
|
||||
_t *_end = VECTOR_ITER_END((_x)); \
|
||||
_t *_iter = VECTOR_BEGIN((_x)); \
|
||||
_t *_end = VECTOR_END((_x)); \
|
||||
for(;_iter != _end;++_iter) \
|
||||
{ \
|
||||
if(_f(__VA_ARGS__, _iter)) \
|
||||
|
@ -98,7 +98,7 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo
|
||||
|
||||
effectslots[cur] = slot->id;
|
||||
}
|
||||
err = AddEffectSlotArray(context, VECTOR_ITER_BEGIN(slotvec), n);
|
||||
err = AddEffectSlotArray(context, VECTOR_BEGIN(slotvec), n);
|
||||
if(err != AL_NO_ERROR)
|
||||
{
|
||||
alDeleteAuxiliaryEffectSlots(cur, effectslots);
|
||||
@ -394,7 +394,7 @@ static ALenum AddEffectSlotArray(ALCcontext *context, ALeffectslot **start, ALsi
|
||||
ALenum err = AL_NO_ERROR;
|
||||
|
||||
LockContext(context);
|
||||
if(!VECTOR_INSERT(context->ActiveAuxSlots, VECTOR_ITER_END(context->ActiveAuxSlots), start, start+count))
|
||||
if(!VECTOR_INSERT(context->ActiveAuxSlots, VECTOR_END(context->ActiveAuxSlots), start, start+count))
|
||||
err = AL_OUT_OF_MEMORY;
|
||||
UnlockContext(context);
|
||||
|
||||
@ -408,7 +408,7 @@ static void RemoveEffectSlotArray(ALCcontext *context, const ALeffectslot *slot)
|
||||
LockContext(context);
|
||||
#define MATCH_SLOT(_i) (slot == *(_i))
|
||||
VECTOR_FIND_IF(iter, ALeffectslot*, context->ActiveAuxSlots, MATCH_SLOT);
|
||||
if(iter != VECTOR_ITER_END(context->ActiveAuxSlots))
|
||||
if(iter != VECTOR_END(context->ActiveAuxSlots))
|
||||
{
|
||||
*iter = VECTOR_BACK(context->ActiveAuxSlots);
|
||||
VECTOR_POP_BACK(context->ActiveAuxSlots);
|
||||
|
Loading…
x
Reference in New Issue
Block a user