diff options
author | Chris Robinson <[email protected]> | 2014-03-21 14:03:26 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-03-21 14:03:26 -0700 |
commit | 983fa4630a8ba68f2e446cc0b05234fd5399c9bd (patch) | |
tree | 2689c13e32ae6c81d47cab3f20c3f5faaadf4754 | |
parent | 40a0692a1c9cc022c224577a3806ae9f0599695f (diff) |
Rename the vector's Max field to Capacity
-rw-r--r-- | Alc/helpers.c | 4 | ||||
-rw-r--r-- | Alc/midi/sf2load.c | 16 | ||||
-rw-r--r-- | Alc/vector.h | 10 |
3 files changed, 15 insertions, 15 deletions
diff --git a/Alc/helpers.c b/Alc/helpers.c index 80aab889..69c49db1 100644 --- a/Alc/helpers.c +++ b/Alc/helpers.c @@ -709,13 +709,13 @@ ALboolean vector_reserve(void *ptr, size_t orig_count, size_t base_size, size_t void *temp; /* Need to be explicit with the caller type's base size, because it - * could have extra padding between the count and array start (that is, + * could have extra padding before the start of the array (that is, * sizeof(*vector_) may not equal base_size). */ temp = realloc(*vecptr, base_size + obj_size*obj_count); if(temp == NULL) return AL_FALSE; *vecptr = temp; - (*vecptr)->Max = obj_count; + (*vecptr)->Capacity = obj_count; } return AL_TRUE; } diff --git a/Alc/midi/sf2load.c b/Alc/midi/sf2load.c index ff6bee5e..b2db35cd 100644 --- a/Alc/midi/sf2load.c +++ b/Alc/midi/sf2load.c @@ -349,12 +349,12 @@ static GenModList GenModList_clone(const GenModList *self) GenModList ret; GenModList_Construct(&ret); - VECTOR_RESERVE(ret.gens, VECTOR_MAX(self->gens)); + VECTOR_RESERVE(ret.gens, VECTOR_CAPACITY(self->gens)); memcpy(ret.gens, self->gens, sizeof(ret.gens) + - VECTOR_MAX(ret.gens) * sizeof(ret.gens->Data[0])); - VECTOR_RESERVE(ret.mods, VECTOR_MAX(self->mods)); + VECTOR_CAPACITY(ret.gens) * sizeof(ret.gens->Data[0])); + VECTOR_RESERVE(ret.mods, VECTOR_CAPACITY(self->mods)); memcpy(ret.mods, self->mods, sizeof(ret.mods) + - VECTOR_MAX(ret.mods) * sizeof(ret.mods->Data[0])); + VECTOR_CAPACITY(ret.mods) * sizeof(ret.mods->Data[0])); return ret; } @@ -383,7 +383,7 @@ static void GenModList_insertGen(GenModList *self, const Generator *gen, ALboole if(VECTOR_RESERVE(self->gens, NextPowerOf2(VECTOR_SIZE(self->gens)+1)) == AL_FALSE) { ERR("Failed to increase generator storage to %d elements (from %d)\n", - NextPowerOf2(VECTOR_SIZE(self->gens)+1), VECTOR_MAX(self->gens)); + NextPowerOf2(VECTOR_SIZE(self->gens)+1), VECTOR_CAPACITY(self->gens)); return; } @@ -415,7 +415,7 @@ static void GenModList_accumGen(GenModList *self, const Generator *gen) if(VECTOR_RESERVE(self->gens, NextPowerOf2(VECTOR_SIZE(self->gens)+1)) == AL_FALSE) { ERR("Failed to increase generator storage to %d elements (from %d)\n", - NextPowerOf2(VECTOR_SIZE(self->gens)+1), VECTOR_MAX(self->gens)); + NextPowerOf2(VECTOR_SIZE(self->gens)+1), VECTOR_CAPACITY(self->gens)); return; } @@ -441,7 +441,7 @@ static void GenModList_insertMod(GenModList *self, const Modulator *mod) if(VECTOR_RESERVE(self->mods, NextPowerOf2(VECTOR_SIZE(self->mods)+1)) == AL_FALSE) { ERR("Failed to increase modulator storage to %d elements (from %d)\n", - NextPowerOf2(VECTOR_SIZE(self->mods)+1), VECTOR_MAX(self->mods)); + NextPowerOf2(VECTOR_SIZE(self->mods)+1), VECTOR_CAPACITY(self->mods)); return; } @@ -464,7 +464,7 @@ static void GenModList_accumMod(GenModList *self, const Modulator *mod) if(VECTOR_RESERVE(self->mods, NextPowerOf2(VECTOR_SIZE(self->mods)+1)) == AL_FALSE) { ERR("Failed to increase modulator storage to %d elements (from %d)\n", - NextPowerOf2(VECTOR_SIZE(self->mods)+1), VECTOR_MAX(self->mods)); + NextPowerOf2(VECTOR_SIZE(self->mods)+1), VECTOR_CAPACITY(self->mods)); return; } diff --git a/Alc/vector.h b/Alc/vector.h index 81ba5baf..bcf9166d 100644 --- a/Alc/vector.h +++ b/Alc/vector.h @@ -7,12 +7,12 @@ /* "Base" vector type, designed to alias with the actual vector types. */ typedef struct vector__s { - ALsizei Max; + ALsizei Capacity; ALsizei Size; } *vector_; #define DECL_VECTOR(T) typedef struct vector_##T##_s { \ - ALsizei Max; \ + ALsizei Capacity; \ ALsizei Size; \ T Data[]; \ } *vector_##T; @@ -22,10 +22,10 @@ typedef struct vector__s { /* Helper to increase a vector's reserve. Do not call directly. */ ALboolean vector_reserve(void *ptr, size_t orig_count, size_t base_size, size_t obj_count, size_t obj_size); -#define VECTOR_RESERVE(_x, _c) (vector_reserve(&(_x), (_x)->Max, sizeof(*(_x)), (_c), sizeof((_x)->Data[0]))) +#define VECTOR_RESERVE(_x, _c) (vector_reserve(&(_x), (_x)->Capacity, sizeof(*(_x)), (_c), sizeof((_x)->Data[0]))) -#define VECTOR_SIZE(_x) ((const ALsizei)(_x)->Size) -#define VECTOR_MAX(_x) ((const ALsizei)(_x)->Max) +#define VECTOR_CAPACITY(_x) ((const ALsizei)(_x)->Capacity) +#define VECTOR_SIZE(_x) ((const ALsizei)(_x)->Size) #define VECTOR_ITER_BEGIN(_x) ((_x)->Data) #define VECTOR_ITER_END(_x) ((_x)->Data + (_x)->Size) |