diff options
author | Chris Robinson <[email protected]> | 2017-04-14 22:56:54 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-04-14 23:50:49 -0700 |
commit | d9bf4f7620c1e13846a53ee9df5c8c9eb2fcfe7d (patch) | |
tree | b3ab3fb963b8fbc5dbcafe4c8a6ffbd9e72ec572 /common/uintmap.c | |
parent | afb59e7f98f40cde77c150414a8a5bd13f40781a (diff) |
Allow increasing the maximum source limit
If the requested number of mono and stereo sources exceeds 256, the source
limit will be expanded. Any config file setting overrides this. If the device
is reset to have fewer sources than are currently allocated, excess sources
will remain and be usable as normal, but no more can be generated until enough
are delated to go back below the limit.
Diffstat (limited to 'common/uintmap.c')
-rw-r--r-- | common/uintmap.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/common/uintmap.c b/common/uintmap.c index 21a921b2..98ed3191 100644 --- a/common/uintmap.c +++ b/common/uintmap.c @@ -36,6 +36,11 @@ void ResetUIntMap(UIntMap *map) WriteUnlock(&map->lock); } +void RelimitUIntMapNoLock(UIntMap *map, ALsizei limit) +{ + map->limit = limit; +} + ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value) { ALsizei pos = 0; @@ -59,7 +64,7 @@ ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value) if(pos == map->size || map->keys[pos] != key) { - if(map->size == map->limit) + if(map->size >= map->limit) { WriteUnlock(&map->lock); return AL_OUT_OF_MEMORY; @@ -141,7 +146,7 @@ ALenum InsertUIntMapEntryNoLock(UIntMap *map, ALuint key, ALvoid *value) if(pos == map->size || map->keys[pos] != key) { - if(map->size == map->limit) + if(map->size >= map->limit) return AL_OUT_OF_MEMORY; if(map->size == map->capacity) |