Make a function static that's only used in one source file
[openal-soft.git] / common / uintmap.h
blob3adc66c45b5e250683edda762182ee04e10a05f5
1 #ifndef AL_UINTMAP_H
2 #define AL_UINTMAP_H
4 #include <limits.h>
6 #include "AL/al.h"
7 #include "rwlock.h"
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
13 typedef struct UIntMap {
14 ALuint *keys;
15 /* Shares memory with keys. */
16 ALvoid **values;
18 ALsizei size;
19 ALsizei capacity;
20 ALsizei limit;
21 RWLock lock;
22 } UIntMap;
23 #define UINTMAP_STATIC_INITIALIZE_N(_n) { NULL, NULL, 0, 0, (_n), RWLOCK_STATIC_INITIALIZE }
24 #define UINTMAP_STATIC_INITIALIZE UINTMAP_STATIC_INITIALIZE_N(INT_MAX)
26 void InitUIntMap(UIntMap *map, ALsizei limit);
27 void ResetUIntMap(UIntMap *map);
28 void RelimitUIntMapNoLock(UIntMap *map, ALsizei limit);
29 ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value);
30 ALenum InsertUIntMapEntryNoLock(UIntMap *map, ALuint key, ALvoid *value);
31 ALvoid *RemoveUIntMapKey(UIntMap *map, ALuint key);
32 ALvoid *RemoveUIntMapKeyNoLock(UIntMap *map, ALuint key);
33 ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key);
34 ALvoid *LookupUIntMapKeyNoLock(UIntMap *map, ALuint key);
36 inline void LockUIntMapRead(UIntMap *map)
37 { ReadLock(&map->lock); }
38 inline void UnlockUIntMapRead(UIntMap *map)
39 { ReadUnlock(&map->lock); }
40 inline void LockUIntMapWrite(UIntMap *map)
41 { WriteLock(&map->lock); }
42 inline void UnlockUIntMapWrite(UIntMap *map)
43 { WriteUnlock(&map->lock); }
45 #ifdef __cplusplus
47 #endif
49 #endif /* AL_UINTMAP_H */