aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/vector.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-07-06 03:27:39 -0700
committerChris Robinson <[email protected]>2014-07-06 03:27:39 -0700
commitd0a64fe191aabe085cabe1737c44ff6a47a3d4d8 (patch)
treea22024a773333fd6beb4e1af95af5497477045bd /Alc/vector.h
parent5de7271bcd4df9a26301a37ed9cf76ddc6641328 (diff)
Don't require pre-declaring vector types
Diffstat (limited to 'Alc/vector.h')
-rw-r--r--Alc/vector.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/Alc/vector.h b/Alc/vector.h
index 5e169f24..944cccc2 100644
--- a/Alc/vector.h
+++ b/Alc/vector.h
@@ -11,15 +11,23 @@ typedef struct vector__s {
ALsizei Size;
} *vector_;
-#define DECL_VECTOR(T) typedef struct vector_##T##_s { \
+#define TYPEDEF_VECTOR(T, N) typedef struct { \
ALsizei Capacity; \
ALsizei Size; \
T Data[]; \
-} *vector_##T; \
-typedef const struct vector_##T##_s *const_vector_##T;
+} _##N; \
+typedef _##N* N; \
+typedef const _##N* const_##N;
-#define VECTOR_INIT(_x) do { (_x) = NULL; } while(0)
-#define VECTOR_DEINIT(_x) do { free((_x)); (_x) = NULL; } while(0)
+#define VECTOR(T) struct { \
+ ALsizei Capacity; \
+ ALsizei Size; \
+ T Data[]; \
+}*
+
+#define VECTOR_INIT(_x) do { (_x) = NULL; } while(0)
+#define VECTOR_INIT_STATIC() NULL
+#define VECTOR_DEINIT(_x) do { free((_x)); (_x) = NULL; } while(0)
/* Helper to increase a vector's reserve. Do not call directly. */
ALboolean vector_reserve(void *ptr, size_t base_size, size_t obj_count, size_t obj_size, ALboolean exact);
@@ -63,7 +71,7 @@ ALboolean vector_insert(void *ptr, size_t base_size, size_t obj_size, void *ins_
_t *_iter = VECTOR_ITER_BEGIN((_x)); \
_t *_end = VECTOR_ITER_END((_x)); \
for(;_iter != _end;++_iter) \
- (_f)(_iter); \
+ _f(_iter); \
} while(0)
#endif /* AL_VECTOR_H */