diff options
author | Chris Robinson <[email protected]> | 2014-03-28 05:40:24 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-03-28 05:44:19 -0700 |
commit | af8fda8a4a19e7d51506bf873c719361277249d2 (patch) | |
tree | e32990f884b9d3d6caed01dbccab4c111ee6902d /Alc/vector.h | |
parent | 2ca673cca2205271fc1198e9bbf04695960cf25d (diff) |
Add an al_string type and use it for the device lists
Diffstat (limited to 'Alc/vector.h')
-rw-r--r-- | Alc/vector.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Alc/vector.h b/Alc/vector.h index 4cb6d2b9..7ff65146 100644 --- a/Alc/vector.h +++ b/Alc/vector.h @@ -15,7 +15,8 @@ typedef struct vector__s { ALsizei Capacity; \ ALsizei Size; \ T Data[]; \ -} *vector_##T; +} *vector_##T; \ +typedef const struct vector_##T##_s *const_vector_##T; #define VECTOR_INIT(_x) do { (_x) = calloc(1, sizeof(*(_x))); } while(0) #define VECTOR_DEINIT(_x) do { free((_x)); (_x) = NULL; } while(0) @@ -24,6 +25,10 @@ typedef struct vector__s { ALboolean vector_reserve(void *ptr, size_t orig_count, size_t base_size, size_t obj_count, size_t obj_size, ALboolean exact); #define VECTOR_RESERVE(_x, _c) (vector_reserve(&(_x), (_x)->Capacity, sizeof(*(_x)), (_c), sizeof((_x)->Data[0]), AL_TRUE)) +/* Helper to change a vector's size. Do not call directly. */ +ALboolean vector_resize(void *ptr, size_t base_size, size_t obj_count, size_t obj_size); +#define VECTOR_RESIZE(_x, _c) (vector_resize(&(_x), sizeof(*(_x)), (_c), sizeof((_x)->Data[0]))) + #define VECTOR_CAPACITY(_x) ((const ALsizei)(_x)->Capacity) #define VECTOR_SIZE(_x) ((const ALsizei)(_x)->Size) |